A playback node extending Node2D.
Specify a resource and an animation, then start playback.
@onready var ssnode: SpriteStudioPlayer2D = $target
func _ready() -> void:
# Load the .ssab and assign it as the resource
var ssab: SSABResource = ResourceLoader.load("res://ssab_generated/Sample.ssab")
ssnode.set_ssab_resource(ssab)
# Specify the animation name
ssnode.set_animation("anime_1")
# Play
ssnode.set_loop_count(-1) # -1 = infinite loop
ssnode.set_speed_scale(1.0)
ssnode.play()set_ssab_resource(res: SSABResource)/get_ssab_resource() -> SSABResourceset_animation(name: String)/get_animation() -> Stringset_autoplay(autoplay: bool)/is_autoplay() -> bool: Whether to start playing automatically when the scene starts.set_offset(offset: Vector2)/get_offset() -> Vector2: Shifts the drawing position without moving the Node2D's origin.set_flip_h(flip: bool)/is_flipped_h() -> bool: Flips the animation horizontally.set_flip_v(flip: bool)/is_flipped_v() -> bool: Flips the animation vertically.set_animation_process_mode(mode: int)/get_animation_process_mode() -> int: Sets whether to sync with_physics_process(0/ Physics) or_process(1/ Idle).- In-editor preview: Select the node and use the SpriteStudio bottom panel (play / pause / stop / frame scrubber) to preview without running the game. (The former
editor_playinginspector toggle has been replaced by this panel.) play(start_frame: float = -1.0): Starts playback. Ifstart_frameis-1.0, it plays from the current frame or the start of the section.pause(): Pauses playback while retaining the current frame.stop(): Stops playback and typically resets the state.is_playing() -> bool/is_pausing() -> boolset_frame(frame: float)/get_frame() -> float/get_total_frames() -> intset_speed_scale(speed_scale: float)/get_speed_scale() -> floatset_frame_rate(fps: int)/get_frame_rate() -> intset_animation_section(start: int, end: int): Limits the playback to a specific frame range.set_playback_direction(direction: int, style: int): Sets the playback direction and style. See the table below for values.set_loop_count(count: int)/get_loop_count() -> int:-1means infinite loop.0plays once with no repeat.nrepeatsntimes.set_frame_skip_enabled(enabled: bool)/is_frame_skip_enabled() -> bool(default:true)set_sub_frame_enabled(enabled: bool)/is_sub_frame_enabled() -> bool(default:false)set_cellmap_texture(cellmap_name: String, texture: Texture2D)/get_cellmap_texture(cellmap_name: String) -> Texture2D
| Argument | Value | Meaning |
|---|---|---|
direction |
0 |
Forward |
direction |
1 |
Backward |
style |
0 |
Normal / One-way |
style |
1 |
PingPong (Round-trip) |
| Signal | Arguments | Emitted When |
|---|---|---|
animation_started |
anim_name: String |
Playback starts |
animation_changed |
anim_name: String |
The animation name is changed |
animation_finished |
anim_name: String |
Playback reaches the end (non-looping only) |
animation_looped |
anim_name: String |
The animation loops back to the start |
user_data |
payload: Dictionary |
A "User Data" keyframe on the timeline is hit |
signal_emitted |
command: String, value: Dictionary |
A "Signal" keyframe on the timeline is hit |
The User Data values configured in SpriteStudio are delivered as a Dictionary. Only the keys that were set are present — unset fields are omitted entirely.
| Key | Type | Meaning |
|---|---|---|
integer |
int |
Integer value |
point |
Vector2 |
Point value |
rect |
Rect2 |
Rectangle value (x, y, width, height) |
string |
String |
String value |
The parameters configured on the timeline "Signal" keyframe are delivered as a Dictionary keyed by parameter ID, with each value as bool / int / float / String, etc. The command argument receives the signal name (command_id).
Note
For the exact types and the latest set of accepted values, also refer to the implementation files ss_player/ss_player_node_2d.h and ss_player/ss_internal_player.cpp.
The frame property is animatable, so an AnimationPlayer can scrub a SpriteStudio animation in lockstep with its own timeline (and any other tracks on it — audio, calls, other nodes).
- Assign
SSAB Resourceand pick anAnimationon theSpriteStudioPlayer2Das usual. - In the
AnimationPlayer, add a Property Track targeting the node'sframeproperty. - Keyframe
frameover time (e.g.0→ the last frame across the desired duration).frameis a float, so values interpolate. - Play the
AnimationPlayer.
Important
While the AnimationPlayer drives frame, do not let the node play itself — leave Autoplay off and don't call play(). Otherwise the node's own playback and the keyframed frame fight each other every frame.
No setup beyond this is required: keyframe values live in the AnimationPlayer's animation (the node's frame is not stored in the scene), and the same track drives playback at runtime.