JOYLINK STUDIO

DOCUMENTATION / 03

Player API

Use a GameObject for each independently controlled player.

Create a player

Attach this example to a GameObject and assign a valid baked resource. The bake window can also create a bound player for you. SetAnimation uses a zero-based clip index and resets playback time to zero.

using JoyLinkStudio.SpineGpuAnimation;
using UnityEngine;

public sealed class PlayBakedAnimation : MonoBehaviour
{
    [SerializeField] private GpuAnimationResource bakedResource;

    private void Start()
    {
        if (bakedResource == null) return;
        var player = gameObject.AddComponent<GpuAnimationPlayer>();
        player.Resource = bakedResource;
        player.SetAnimation(0);
        player.Speed = 0.8f;
        player.Loop = true;
        player.Seek(0.35f);
        player.Paused = false;
    }
}

Playback controls

APIPurpose
ResourceAssign a validated resource; resets clip and time.
SetAnimation(index)Select a clip; time resets to zero.
Seek(seconds)Wrap in loop mode; clamp otherwise.
SpeedIndependent finite speed; zero and negative values allowed.
Loop / PausedConfigure looping and pause/resume.
TimeSeconds / AnimationIndexRead the current time and selected clip.

Automatic time and shared assets

Enabled players advance time in Update. Disabling unregisters drawing and stops automatic Update. Assign the same baked resource to multiple players to share animation assets. Do not destroy the shared mesh/material/texture when removing a player. The core has no Spine API dependency.

Do not manually call Advance every frame while the enabled Player already updates, or time will advance twice. For explicitly controlled bulk updates, use Crowd with AutoAdvance disabled.