Forum rules - please read before posting.

Spine NPC Character Animation in Timeline

Hi Chris,

I already have a Timeline with my NPC Sprites Unity character moving and animating about. Is there an easy way to replace this with a Spine NPC?

Comments

  • edited May 2022

    This is unrelated to AC, but a video on this topic can be found here.

  • Ok thank you, s and this would work the same way for Player prefab too? Following the AC method also?
  • If you use a "dummy" Player object in your Timeline, you can remap it to your "live" Player by checking Remap bindings? in the Engine: Control Timeline Action.

  • Hi Chris, can you elaborate further on the above? this dummy player object, is it just an instance of the prefab in scene? And what happens to it before and after the timeline? Thanks

  • If your Player is spawned in at runtime by the Settings Manager, but still want them controlled by Timelines, place an instance of the prefab into the scene while in Edit mode and control them in your Timeline.

    You can remove their Player component while doing so, or remove them from the scene file before entering Play mode. Either way, you'll need to remap the tracks that rely on this instance to the runtime prefab via the option I mention above.

    If still in the scene, the original Player copy used to create the Timeline tracks will no longer be referenced by the Timeline and so unaffected by its playback state.

  • Is this also possible with Spine animation?

  • Spine requires its own Timeline tracks, available on Spine's website.

    Out of the box, it doesn't support rebinding - but this can be done for the Spine Animation State track type by modifying the top of the SpineAnimationStateMixerBehaviour script's ProcessFrame function to the following:

    var skeletonAnimation = (playerData as GameObject).GetComponent<SkeletonAnimation> ();
    var skeletonGraphic = (playerData as GameObject).GetComponent <SkeletonGraphic> ();
    animationStateComponent = (playerData as GameObject).GetComponent <IAnimationStateComponent> ();
    var skeletonComponent = (playerData as GameObject).GetComponent <ISkeletonComponent> ();
    if (animationStateComponent.IsNullOrDestroyed() || skeletonComponent == null) return;
    
  • I do not have this script, and cannot seem to find it online, can you share please?

  • edited May 2023

    Hi, I get this error after adding the script without the code:

    Assets/Sleepytime Village/Scripts/SpineAnimationStateMixerBehaviour.cs(201,31): error CS1061: 'IAnimationStateComponent' does not contain a definition for 'UnscaledTime' and no accessible extension method 'UnscaledTime' accepting a first argument of type 'IAnimationStateComponent' could be found (are you missing a using directive or an assembly reference?)

  • Have you imported the script without the rest of the Github code?

    This is not an AC issue.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.