Spriteclass

Represents a sprite resource that can be static or animated. Sprites are rendererd using the SpriteRenderer component.

objectGameResourceSprite
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.Sprite : Sandbox.GameResource

Constructors1

Showing 1 constructors

public Sprite()PUBLICCONSTRUCTOR

Methods5

Showing 5 methods

public static Sandbox.Sprite FromTexture(Sandbox.Texture texture)PUBLICSTATIC

Returns a sprite with a single frame animation using the provided texture.

ParameterTypeDescription
textureTextureThe texture to be used
Returns:Sprite

public static Sandbox.Sprite FromTextures(System.Collections.Generic.IEnumerable`1<Sandbox.Texture> textures, float frameRate = 15)PUBLICSTATIC

ParameterTypeDescription
texturesIEnumerable<Texture>
frameRate = 15float
Returns:Sprite

public int GetAnimationIndex(string name)PUBLIC

Get the index of an animation by its name. Returns -1 if not found.

ParameterTypeDescription
namestringThe name of the animation
Returns:int

Properties2

Showing 2 properties

public System.Collections.Generic.List`1<Sandbox.Sprite.Animation> Sandbox.Sprite.Animations { get; set; }PUBLICGETSET

A list of animations that can be played. Some animations can consist of multiple frames. If a sprite is static, it will only contain a single default animation.

Returns:List<Animation>

public virtual int Sandbox.Sprite.ResourceVersion { get; set; }PUBLICVIRTUALGETSET

Returns:int

On this page