AnimatedTexture
Obsolete frame-based Texture2D; choose task-specific animation for new code.
SDK 1.0.0 marks the entire class Obsolete: its implementation does not work properly and may be removed. This documents existing API rather than recommending it for new projects. Use AnimatedSprite2D with SpriteFrames for animated sprites, or AnimationPlayer for animating a texture property. Neither is a universal drop-in resource replacement wherever Texture2D is accepted.
Stores up to 256 texture/duration slots. Frames activates the first N slots; SetFrameTexture does not increase Frames. Slot indices 0…255 differ from valid CurrentFrame indices 0…Frames-1. Select a valid CurrentFrame before reducing Frames: its setter neither clamps the index nor resets time or clears hidden slots. Consumers sharing one resource also share its current frame.
For an existing resource configure slots with Pause=true, assign positive finite durations, then Frames and CurrentFrame, and finally release pause. Stop with Pause rather than SpeedScale=0: the current code gives zero speed a zero frame limit and reverse-direction branch. Negative nonzero speed reverses playback. OneShot holds the terminal frame without setting Pause or providing a completion signal.
Source inspection shows an OS-clock timer updated at frame_pre_draw. Time accumulates even while paused, allowing catch-up transitions after resume. CurrentFrame clears accumulated time even when assigned its existing index. Texture2D dimensions follow the current frame; use equal frame sizes to avoid changing consumer geometry. AtlasTexture is unsuitable as a separate frame because the proxy receives its RID without atlas-region metadata. An empty slot does not clear the previously bound proxy; null is not a transparent frame.
Setters neither emit Resource.Changed nor forward child-texture changes automatically. The combined suite ran 23 Windows headless state checks for AnimatedTexture/MeshTexture; this class was checked for values, slots, references and dimensions. Playback timing, visible frames and rendering correctness were not established.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
AnimatedTextureConstructor
public AnimatedTexture();Creates an owned obsolete resource: Frames=1, CurrentFrame=0, Pause=false, OneShot=false, SpeedScale=1; every slot is null with duration 1 second. Not recommended for new projects.
Properties5
CurrentFrameProperty
public int CurrentFrame { get; set; }Current index 0…Frames-1. Every assignment, including the same value, resets accumulated time; the proxy updates at the next render callback rather than synchronously in the setter.
FramesProperty
public int Frames { get; set; }Active frame count 1…256. Does not clear inactive slots, change CurrentFrame or reset time. Select a valid CurrentFrame before decreasing it.
OneShotProperty
public bool OneShot { get; set; }Holds the last frame forward or the first in reverse. Reaching the end neither sets Pause nor emits a completion signal.
PauseProperty
public bool Pause { get; set; }Prevents frame transitions without resetting the index. Current source still accumulates elapsed time, allowing catch-up after resume. Does not promise exact phase-preserving continuation.
SpeedScaleProperty
public float SpeedScale { get; set; }Direction/speed multiplier: -1000 ≤ scale < 1000. Nonzero values give a duration/abs(scale) frame limit. Do not use zero as pause: the current implementation uses a zero limit and reverse branch. Use Pause.
Methods14
GetCurrentFrameint
public int GetCurrentFrame();Returns CurrentFrame. Current index 0…Frames-1. Every assignment, including the same value, resets accumulated time; the proxy updates at the next render callback rather than synchronously in the setter.
intCurrent CurrentFrame value.
GetFrameDurationfloat
public float GetFrameDuration(int frame);Reads the configured slot 0…255 duration without applying SpeedScale. A new slot has 1 second.
| Name | Type | Default |
|---|---|---|
frame | int | — |
frameSlot index 0…255, possibly outside active Frames.
floatStored duration in seconds before speed scaling.
GetFrameTextureTexture2D
public Texture2D GetFrameTexture(int frame);Returns the shared texture of slot 0…255, including inactive slots, or null. Not a copy: do not separately dispose an alias still used by an owner.
| Name | Type | Default |
|---|---|---|
frame | int | — |
frameSlot index 0…255, possibly outside active Frames.
Texture2DShared resource or null, not an independent copy.
GetFramesint
public int GetFrames();Returns Frames. Active frame count 1…256. Does not clear inactive slots, change CurrentFrame or reset time. Select a valid CurrentFrame before decreasing it.
intCurrent Frames value.
GetOneShotbool
public bool GetOneShot();Returns OneShot. Holds the last frame forward or the first in reverse. Reaching the end neither sets Pause nor emits a completion signal.
boolCurrent OneShot value.
GetPausebool
public bool GetPause();Returns Pause. Prevents frame transitions without resetting the index. Current source still accumulates elapsed time, allowing catch-up after resume. Does not promise exact phase-preserving continuation.
boolCurrent Pause value.
GetSpeedScalefloat
public float GetSpeedScale();Returns SpeedScale. Direction/speed multiplier: -1000 ≤ scale < 1000. Nonzero values give a duration/abs(scale) frame limit. Do not use zero as pause: the current implementation uses a zero limit and reverse branch. Use Pause.
floatCurrent SpeedScale value.
SetCurrentFramevoid
public void SetCurrentFrame(int frame);Sets CurrentFrame. Current index 0…Frames-1. Every assignment, including the same value, resets accumulated time; the proxy updates at the next render callback rather than synchronously in the setter.
| Name | Type | Default |
|---|---|---|
frame | int | — |
frameIndex 0…Frames-1; assignment also resets time.
SetFrameDurationvoid
public void SetFrameDuration(int frame, float duration);Stores a slot 0…255 duration in seconds. The setter validates neither sign nor finiteness. Use positive finite values; 0 gives a zero limit and can be skipped, while negatives are not a supported playback mode.
| Name | Type | Default |
|---|---|---|
frame | int | — |
duration | float | — |
frameSlot index 0…255, possibly outside active Frames.
durationPositive finite time in seconds before speed scaling.
SetFrameTexturevoid
public void SetFrameTexture(int frame, Texture2D texture);Stores a shared Texture2D reference in slot 0…255 independently of Frames. Does not increase Frames or copy the texture; null clears the slot. The resource itself is forbidden as a frame. AtlasTexture is not supported as a cropped frame.
| Name | Type | Default |
|---|---|---|
frame | int | — |
texture | Texture2D | — |
frameSlot index 0…255, possibly outside active Frames.
textureShared Texture2D or null to clear. For an AnimatedTexture frame use neither AtlasTexture nor the animated resource itself.
SetFramesvoid
public void SetFrames(int frames);Sets Frames. Active frame count 1…256. Does not clear inactive slots, change CurrentFrame or reset time. Select a valid CurrentFrame before decreasing it.
| Name | Type | Default |
|---|---|---|
frames | int | — |
framesActive slot count 1…256; adjust CurrentFrame before decreasing it.
SetOneShotvoid
public void SetOneShot(bool oneShot);Sets OneShot. Holds the last frame forward or the first in reverse. Reaching the end neither sets Pause nor emits a completion signal.
| Name | Type | Default |
|---|---|---|
oneShot | bool | — |
oneShottrue holds the terminal frame; false enables wrapping.
SetPausevoid
public void SetPause(bool pause);Sets Pause. Prevents frame transitions without resetting the index. Current source still accumulates elapsed time, allowing catch-up after resume. Does not promise exact phase-preserving continuation.
| Name | Type | Default |
|---|---|---|
pause | bool | — |
pausetrue prevents transitions, false permits them; accumulated time is retained.
SetSpeedScalevoid
public void SetSpeedScale(float scale);Sets SpeedScale. Direction/speed multiplier: -1000 ≤ scale < 1000. Nonzero values give a duration/abs(scale) frame limit. Do not use zero as pause: the current implementation uses a zero limit and reverse branch. Use Pause.
| Name | Type | Default |
|---|---|---|
scale | float | — |
scaleFinite nonzero multiplier -1000 ≤ scale < 1000. Stop using Pause.
Fields and constants1
MaxFramesField
public const long MaxFrames = 256;Capacity of 256 slots; a C# const long. Neither current Frames nor maximum valid index: the last index is 255.