• RuntimesUnity
  • Prefab and Timeline

Hi,
I'm using Unity and Adventure Creator. In Adventure Creator, the main player character is a prefab. Is there a way to assign a prefab to the SpineSkeletonAnimation Track in Timeline?
Thank you for your help.

Related Discussions
...

To assign a prefab to the SpineSkeletonAnimation Track in Unity's Timeline, you can follow these steps:

  1. Create a Prefab: Ensure your main player character is set up as a prefab with the SkeletonAnimation component.

  2. Add the Prefab to the Scene: Drag the prefab into your scene. This is necessary because Timeline requires a reference to an active GameObject in the scene.

  3. Add SkeletonAnimationPlayableHandle: Add the SkeletonAnimationPlayableHandle component to your SkeletonAnimation GameObject. This component is necessary for the Timeline to control the SkeletonAnimation.

  4. Set Up Timeline:

    • Open the Timeline window and create a new Timeline asset if you haven't already.
    • Right-click on the left side of the Timeline window and select Spine -> SkeletonAnimation Track.
    • Drag your SkeletonAnimation GameObject from the scene into the empty reference property of the new Spine AnimationState Track.
  5. Add Animations:

    • Drag the respective AnimationReferenceAsset into the clips view (the right part of the Timeline panel) as you would with normal animation clips.

Here is a visual guide from the spine-unity Timeline Extension UPM Package documentation:

For more detailed steps, you can refer to the spine-unity Timeline Extension UPM Package documentation.

If you encounter any issues, ensure that your prefab is correctly set up and that the SkeletonAnimation component is properly configured.

  • Изменено

Thanks, Bot. But somehow this isn't working. I'll investigate more

I followed the instructions from this link: "https://www.adventurecreator.org/forum/discussion/12512/spine-npc-character-animation-in-timeline" and updated the ProcessFrame function in this code: "EsotericSoftware/spine-runtimesblob/4.1/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs" I also followed the rest of the instructions from the AC post.

However, neither the prefab nor the prefab instance seem to work. I've attached the SkeletonAnimationPlayableHandle component to both the prefab and the prefab instance. Can anyone offer some advice? Thank you so much.

@acai It looks as if your prefab GameObject does not contain the SkeletonAnimation at the top, but as a child. We can't say for sure since you haven't shared any screenshots or description of what your actual prefab setup looks like. In general it would help a lot if you could describe everything in as much detail as possible, for example "However, neither the prefab nor the prefab instance seem to work." does not describe what the actual problem is you encountered: were you unable to assign the reference, or could you assign it but nothing was playing, or were you receiving error log messages, etc.

The referenced URL lists e.g. the following code modifications:
var skeletonAnimation = (playerData as GameObject).GetComponent<SkeletonAnimation> ();
Did you debug the code and set breakpoints there? Were any references found and assigned as they should be, or was everything set to null?