Open QQ1273459693 opened 6 months ago
Try this
Bassically its:
Instead of callback in each sequence, you can add an event that calls the function you want to call.
Or you can also do it with code like this if you don't want to add it in the inspector. (I didnt make a clear documentation for it tho):
using UnityEngine;
public class CallbackTest : MonoBehaviour
{
// Assign the AnimationUI component in the inspector
[SerializeField] AnimationUI animationUI;
void Start()
{
animationUI.AnimationSequence[2].Event.AddListener(AfterAMoveToB);
animationUI.AnimationSequence[5].Event.AddListener(AfterAMoveToC);
}
void AfterAMoveToB()
{
Debug.Log("Callback After A move to B");
}
void AfterAMoveToC()
{
Debug.Log("Callback After A move to C");
}
}
Another alternative is to add multiple AnimationUI component. Then look at the Readme.md and use the AddFunctionAtEnd
to each animation. Make sure the second one has wait sequence.
It would be perfect if you could implement a callback after each movement, e.g., after object A moves to position B, I'll move A to position C again, and then I'll call the callback after each movement.