s&box docs

public sealed class Sandbox.SpriteRenderer : Sandbox.Renderer

Renders a sprite in the world

Broader workflow and conceptual references connected to this API.

Constructors

Showing 1 constructors

Methods

Showing 2 methods

Properties

Showing 26 properties

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

Whether or not the sprite should be rendered additively.

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

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.

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

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

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

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

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

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

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.

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

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

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

Whether or not the sprite should be flipped horizontally.

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

Whether or not the sprite should be flipped vertically.

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

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

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

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

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

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.

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

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

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

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

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

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

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

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

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

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

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

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

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

Whether or not the sprite should cast shadows.

public Vector2 Sandbox.SpriteRenderer.Size { get; set; }

The width and height of the sprite in world units.

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

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

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

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

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

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

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

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

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.SpriteRenderer

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