Api Sandbox Sprite
class

Sprite

public sealed class Sprite : GameResource

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

Constructors

Sprite()

Properties

Name Type Description
Animations List<Animation> 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.

Methods

Int32 GetAnimationIndex(String name)

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

name — The name of the animation
Animation GetAnimation(Int32 index)

Get an animation by its index. Returns null if out of bounds.

index — The index of the animation
Animation GetAnimation(String name)

Get an animation by its name. Returns null if not found.

name — The name of the animation
static Sprite FromTexture(Texture texture)

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

texture — The texture to be used
static Sprite FromTextures(IEnumerable<Texture> textures, Single frameRate = 15)
Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.Sprite