SpriteRendererclass

Renders a sprite in the world

objectRendererSpriteRenderer
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.SpriteRenderer : Sandbox.Renderer

Constructors1

Showing 1 constructors

Methods2

Showing 2 methods

Properties26

Showing 26 properties

public virtual sealed bool Sandbox.SpriteRenderer.Additive { get; set; }PUBLICVIRTUALGETSET

Whether or not the sprite should be rendered additively.

Returns:bool

public float Sandbox.SpriteRenderer.AlphaCutoff { get; set; }PUBLICGETSET

Alpha threshold for discarding pixels. Pixels with alpha below this value will be discarded. Only used when Opaque is true. Range: 0.0 (transparent) to 1.0 (opaque). Default is 0.5.

Returns:float

public Color Sandbox.SpriteRenderer.Color { get; set; }PUBLICGETSET

The color of the sprite. This is multiplied with the texture color.

Returns:Color

public virtual int Sandbox.SpriteRenderer.ComponentVersion { get; set; }PUBLICVIRTUALGETSET

Returns:int

public Sandbox.Sprite.Animation Sandbox.SpriteRenderer.CurrentAnimation { get; set; }PUBLICGETSET

The animation that is currently being played. Returns null if no sprite is set or the sprite has no animations.

Returns:Animation

public int Sandbox.SpriteRenderer.CurrentFrameIndex { get; set; }PUBLICGETSET

The index of the current frame being displayed. This will change over time if the sprite is animated, and can be set to go to a specific frame even during playback.

Returns:int

public float Sandbox.SpriteRenderer.DepthFeather { get; set; }PUBLICGETSET

Amount of feathering applied to the depth, softening its intersection with geometry.

Returns:float

public bool Sandbox.SpriteRenderer.FlipHorizontal { get; set; }PUBLICGETSET

Whether or not the sprite should be flipped horizontally.

Returns:bool

public bool Sandbox.SpriteRenderer.FlipVertical { get; set; }PUBLICGETSET

Whether or not the sprite should be flipped vertically.

Returns:bool

public float Sandbox.SpriteRenderer.FogStrength { get; set; }PUBLICGETSET

The strength of the fog effect applied to the sprite. This determines how much the sprite blends with any fog in the scene.

Returns:float

public bool Sandbox.SpriteRenderer.IsAnimated { get; set; }PUBLICGETSET

Whether or not the sprite is animated. This is true if the sprite has more than one animation.

Returns:bool

public virtual sealed bool Sandbox.SpriteRenderer.IsSorted { get; set; }PUBLICVIRTUALGETSET

Whether or not the sprite should be sorted by depth. If the sprite is opaque, this can be turned off for a performance boost if not needed.

Returns:bool

public bool Sandbox.SpriteRenderer.Lighting { get; set; }PUBLICGETSET

Whether or not the sprite should be lit by the scene's lighting system. Otherwise it will be unlit/fullbright.

Returns:bool

public System.Action`1<string> Sandbox.SpriteRenderer.OnAnimationEnd { get; set; }PUBLICGETSET

This action is invoked when an animation finishes playing or has looped. The string parameter is the name of the animation.

Returns:Action<string>

public System.Action`1<string> Sandbox.SpriteRenderer.OnAnimationStart { get; set; }PUBLICGETSETLIFECYCLE

This action is invoked when an animation starts playing. The string parameter is the name of the animation that started.

Returns:Action<string>

public System.Action`1<string> Sandbox.SpriteRenderer.OnBroadcastMessage { get; set; }PUBLICGETSET

This action is invoked when advancing to a new frame that has broadcast messages. The string parameter is the message being broadcast.

Returns:Action<string>

public virtual sealed bool Sandbox.SpriteRenderer.Opaque { get; set; }PUBLICVIRTUALGETSET

Whether or not the sprite should be rendered opaque. If true, any semi-transparent pixels will be dithered.

Returns:bool

public float Sandbox.SpriteRenderer.PlaybackSpeed { get; set; }PUBLICGETSET

The playback speed of the animation. 0 is paused, and negative values will play the animation in reverse.

Returns:float

public virtual sealed bool Sandbox.SpriteRenderer.Shadows { get; set; }PUBLICVIRTUALGETSET

Whether or not the sprite should cast shadows.

Returns:bool

public Sandbox.Sprite Sandbox.SpriteRenderer.Sprite { get; set; }PUBLICGETSET

The sprite resource to render. This can be completely static or contain animation(s).

Returns:Sprite

public string Sandbox.SpriteRenderer.StartingAnimationName { get; set; }PUBLICGETSET

The animation that this sprite should start playing when the scene starts.

Returns:string

public Sandbox.Texture Sandbox.SpriteRenderer.Texture { get; set; }PUBLICGETSET

The texture of the current frame being displayed. Returns a transparent texture when no valid frame is available.

Returns:Texture

public Sandbox.Rendering.FilterMode Sandbox.SpriteRenderer.TextureFilter { get; set; }PUBLICGETSET

The texture filtering mode used when rendering the sprite. For pixelated sprites, use `Sandbox.UI.ImageRendering.Point`.

Returns:FilterMode

On this page

Constructorspublic SpriteRenderer()Methodspublic System.Void PlayAnimation(System.Int32 index)public System.Void PlayAnimation(System.String name)Propertiespublic virtual sealed System.Boolean Sandbox.SpriteRenderer.Additive { get; set; }public System.Single Sandbox.SpriteRenderer.AlphaCutoff { get; set; }public Sandbox.SpriteRenderer.BillboardMode Sandbox.SpriteRenderer.Billboard { get; set; }public Color Sandbox.SpriteRenderer.Color { get; set; }public virtual System.Int32 Sandbox.SpriteRenderer.ComponentVersion { get; set; }public Sandbox.Sprite.Animation Sandbox.SpriteRenderer.CurrentAnimation { get; set; }public System.Int32 Sandbox.SpriteRenderer.CurrentFrameIndex { get; set; }public System.Single Sandbox.SpriteRenderer.DepthFeather { get; set; }public System.Boolean Sandbox.SpriteRenderer.FlipHorizontal { get; set; }public System.Boolean Sandbox.SpriteRenderer.FlipVertical { get; set; }public System.Single Sandbox.SpriteRenderer.FogStrength { get; set; }public System.Boolean Sandbox.SpriteRenderer.IsAnimated { get; set; }public virtual sealed System.Boolean Sandbox.SpriteRenderer.IsSorted { get; set; }public System.Boolean Sandbox.SpriteRenderer.Lighting { get; set; }public System.Action`1<System.String> Sandbox.SpriteRenderer.OnAnimationEnd { get; set; }public System.Action`1<System.String> Sandbox.SpriteRenderer.OnAnimationStart { get; set; }public System.Action`1<System.String> Sandbox.SpriteRenderer.OnBroadcastMessage { get; set; }public virtual sealed System.Boolean Sandbox.SpriteRenderer.Opaque { get; set; }public Color Sandbox.SpriteRenderer.OverlayColor { get; set; }public System.Single Sandbox.SpriteRenderer.PlaybackSpeed { get; set; }public virtual sealed System.Boolean Sandbox.SpriteRenderer.Shadows { get; set; }public Vector2 Sandbox.SpriteRenderer.Size { get; set; }public Sandbox.Sprite Sandbox.SpriteRenderer.Sprite { get; set; }public System.String Sandbox.SpriteRenderer.StartingAnimationName { get; set; }public Sandbox.Texture Sandbox.SpriteRenderer.Texture { get; set; }public Sandbox.Rendering.FilterMode Sandbox.SpriteRenderer.TextureFilter { get; set; }Metadata