🔄 Migration from SS6Player for Unity¶
When migrating from the legacy SS6Player for Unity to this plugin, please note the following major changes. This version overhauls not only the internal implementation (the Rust core libssruntime + the Job System), but also the asset pipeline and the C# API. This is not a drop-in replacement: you will need to re-import your assets and rewrite your scripts.
1. Asset Format and Import Pipeline¶
- SS6Player:
.sspjfiles were imported viaTools > SpriteStudio6 > Importer, generating a.prefabper animation plus a set of.asset(ScriptableObject) files such asScript_SpriteStudio6_DataProject/DataAnimation/DataCellMap/DataEffect. You also had to choose an import mode (SS6PU/UNITY_NATIVE/UNITY_UI, etc.). - Current version: Generates a single
SpriteStudioAnimeAsset(ScriptableObject) that wraps the optimized binary format.ssab. No prefabs are generated, and there is no import-mode selection (world vs. Canvas is chosen when you place the component). - Open
Window > SpriteStudio > Importerand simply drag & drop your.sspj. The default output folder isAssets/ssab_generated. - The
.prefab/.assetfiles produced by the old version cannot be used in this version. Re-import from your.sspjsources. - See Basic Usage and Asset Import & Editor Integration for details.
2. Components and Placement¶
- SS6Player: You placed the generated prefab into the scene. The prefab carried
Script_SpriteStudio6_Root: alone in the defaultSS6PUimport mode (drawn through a MeshRenderer), or combined withScript_SpriteStudio6_RootUnityNative(UNITY_NATIVE, drawn by Unity's own renderers, one per part) orScript_SpriteStudio6_RootUnityUI(UNITY_UI, uGUI/Canvas). All classes live in the global namespace. - Current version: Instead of prefabs, you use one of two components depending on the use case. The namespace is
SpriteStudio.Runtime.
| Use case | SS6Player | Current version |
|---|---|---|
| World space (3D/2D) | Script_SpriteStudio6_Root (SS6PU), or + RootUnityNative (UNITY_NATIVE) |
SpriteStudioPlayer (MeshRenderer) |
| Canvas (uGUI) UI | Script_SpriteStudio6_Root + RootUnityUI |
SpriteStudioGraphic (CanvasRenderer) |
- To place it, drag & drop the generated
SpriteStudioAnimeAssetinto the Hierarchy and pickSpriteStudioPlayer/SpriteStudioGraphicfrom the menu. You can also add the component manually. - Both components share the same playback and event API. Unlike SS6Player, where classes differed per mode, your scripting code is identical for world and Canvas.
3. Playback Control API¶
The API has moved from SS6Player's track-centric model (indexTrack) to a simple, Unity-idiomatic set of methods and properties.
3-1. Select animations by name, not index¶
- SS6Player: You resolved an index with
IndexGetAnimation("walk")and passed that index toAnimationPlay(indexTrack, indexAnimation, ...). - Current version: You specify the name directly with
SetAnimation("walk"), then callPlay().
using SpriteStudio.Runtime;
[SerializeField] private SpriteStudioPlayer _player;
// SS6Player:
// int idx = _root.IndexGetAnimation("walk");
// _root.AnimationPlay(0, idx, 0); // track 0, infinite loop
// Current version:
_player.SetAnimation("walk");
_player.LoopCount = -1; // infinite loop
_player.Play();
3-2. Method / property mapping¶
| SS6Player | Current version | Notes |
|---|---|---|
IndexGetAnimation(name) + AnimationPlay(track, index, …) |
SetAnimation(name) + Play() |
Load and start are separated |
AnimationPlay(…, frameOffset) |
Play(float startFrame) |
Start from a given frame. startFrame is a frame number in the animation, not an offset from the start of the section, and is not clamped to the section (frameOffset was relative to the play range) |
AnimationStop(track) |
Stop() |
|
AnimationPause(track, true/false) |
Pause() / Resume() |
Split in two: Pause() holds the frame, Resume() lifts the hold (Play() rewinds) |
CursorSet/Get(track, cursor) |
FrameNo (get/set) |
Seek; fractional frames allowed |
RateTimeSet/Get(track, rate) |
SpeedScale |
Playback speed multiplier |
AnimationPlay(…, timesPlay) |
LoopCount |
See the loop-count difference below |
KindStylePlay.PINGPONG |
PlaybackStyle (enum) |
Ping-pong playback |
Negative rateTime for reverse |
PlaybackDirection (enum) |
Speed and direction are separated (see below) |
AnimationPlay(…, framePerSecond) |
FrameRate |
Playback fps |
labelRangeStart / labelRangeEnd |
SetAnimationSectionByLabel(string startLabel, string endLabel, int startOffset, int endOffset) |
frameRangeOffsetStart / frameRangeOffsetEnd are the offsets. SetAnimationSection(int start, int end) takes frames |
StatusIsPlaying / StatusGetPlay(track) |
IsPlaying |
true even while paused |
StatusGetPause(track) |
IsPausing |
|
| (none) | IsPlayingForward |
The actual heading; false on a PlaybackStyle.PingPong return leg. Use it to gate audio |
CountGetAnimation() |
AnimationNames.Length |
3-3. Loop count¶
timesPlay values 0, 1 and n port across unchanged. SS6Player's default -1 meant "keep the previous setting"; here -1 is an infinite loop, and LoopCount simply keeps whatever you last set.
| Meaning | SS6Player timesPlay |
Current version LoopCount |
|---|---|---|
| Infinite loop | 0 |
-1 (preferred) or 0 |
| Play once (no loop) | 1 |
1 |
| Play n times | n |
n |
-1is the canonical value for an infinite loop, and the default.0is accepted as a synonym for it — so atimesPlay = 0copied over still loops forever. There is no value meaning "do not play"; simply don't callPlay().
3-4. Reverse and speed are now separate¶
In SS6Player you reversed playback by passing a negative rateTime. In this version, speed (SpeedScale) and direction (PlaybackDirection) are independent.
// SS6Player: reverse at 2x speed
// _root.RateTimeSet(0, -2.0f);
// Current version:
_player.SetAnimation("walk");
_player.SpeedScale = 2.0f; // speed is a positive multiplier
_player.PlaybackDirection = SpriteStudioPlaybackDirection.Backward; // direction is an enum
_player.Play();
PlaybackDirection/PlaybackStyledescribe the playback rather than the clip, so they surviveSetAnimation()— set them once (beforePlay()), not after every switch. A switch only re-arms the playhead and the loop budget.
4. Events and Callbacks¶
- SS6Player: You assigned functions to delegate fields on
Script_SpriteStudio6_Root(FunctionUserData/FunctionSignal/FunctionSound/FunctionPlayEnd).FunctionUserData,FunctionSignalandFunctionSoundtook many arguments (scriptRoot, nameParts, indexParts, …, ref userData, flagWayBack);FunctionPlayEnd(scriptRoot, objectControl)returned abool(falseauto-destroyed the object). - Current version: Provides both C#
events and inspector-wireableUnityEvents, following Unity conventions. Payloads arrive as structs (SpriteStudioUserData, etc.).
4-1. Event mapping¶
| SS6Player (delegate) | Current version (C# event / UnityEvent) | Payload |
|---|---|---|
FunctionPlayEnd |
OnAnimationFinished / OnAnimationFinishedEvent |
none |
FunctionUserData |
OnUserData / OnUserDataEvent |
SpriteStudioUserData |
FunctionSignal |
OnSignal / OnSignalEvent |
SpriteStudioSignal |
FunctionSound |
OnAudio / OnAudioEvent |
SpriteStudioAudio |
| (new) | OnAnimationStarted / OnAnimationLooped |
none |
4-2. Registration changes¶
// SS6Player:
// _root.FunctionUserData = HandleUserData; // assign to a field
// _root.FunctionPlayEnd = HandlePlayEnd;
// Current version: subscribe/unsubscribe with += / -=
void OnEnable()
{
_player.OnUserData += HandleUserData;
_player.OnAnimationFinished += HandleFinished;
}
void OnDisable()
{
_player.OnUserData -= HandleUserData;
_player.OnAnimationFinished -= HandleFinished;
}
void HandleUserData(SpriteStudioUserData data) // a single struct argument
{
if (data.HasString) Debug.Log(data.StringValue);
if (data.HasInt) Debug.Log(data.IntValue);
}
void HandleFinished() { /* no return value; the auto-destroy behavior is gone */ }
- The
FunctionPlayEndbehavior where "returningfalseauto-destroys the GameObject" no longer exists. If you need that, callDestroy()explicitly insideOnAnimationFinished.- Use the
UnityEventvariants (OnUserDataEvent, etc.) to wire methods on other components directly in the inspector.- For the event data structs (
SpriteStudioUserData/SpriteStudioSignal/SpriteStudioAudio), see Scripting & Events.
5. Other Notes and Behavioral Differences¶
- Multi-track / cross-fade: SS6Player's multi-track layering (
TrackConnectParts()) andTrackTransition()(cross-fade) become the track stack:SetTrackAnimation()lays an animation on a track over the oneSetAnimation()selected, andCrossfade()switches a track with a fade. See Motion Blending. - Effects: No standalone component like SS6Player's
Script_SpriteStudio6_RootEffectis needed. Animations containing effect parts are played inline withinSpriteStudioPlayer/SpriteStudioGraphic. - Attaching GameObjects to parts: SS6Player's
UNITY_NATIVE/UNITY_UImodes made every part a GameObject, so you parented under it. Here the animation is drawn as one mesh: use the Part Trackers feature ofSpriteStudioPlayer(drive an arbitraryTransformto follow a named part). See Scripting & Events. - Timeline: Still supported on the world path.
SpriteStudioPlayerimplementsITimeControl, so you can drive playback time from a Timeline track, or from a dedicatedSpriteStudioTrack.SpriteStudioGraphic(Canvas) cannot be driven from Timeline; see Limitations. - Supported environment: see Installation.
- Per-part Color / Cell / Visibility overrides: SS6Player's
PartsColorChange()/CellChangeParts()/HideSet()are provided as Part Overrides (Override Layer API), which take precedence over keyframes and animation blending. See Scripting & Events. - Collider integration: There is no direct equivalent to SS6Player's collider feature. If you need one, attach a collider to a GameObject driven to follow the target part (Part Trackers; see above).