Hi. I am trying to play an audioclip when an animation starts, and used the following code snippet:
void PlayTransientAnimation(string animation, Action onComplete, Action onStart)
{
var trackEntry = _skeletonAnimation.state.SetAnimation(_transientAnimationTrack, animation, false);
trackEntry.Complete += (state, idx, loopCount) => onComplete();
trackEntry.Start += (state, idx) => onStart();
}
Here is the method passed in as onStart in the above method.
public void PlayAudioClipOneShot()
{
_audioSource.PlayOneShot(PronounceLetter);
}
Problem is, trackEntry.Start is never NOT null... It works fine when I do the following:
void PlayTransientAnimation(string animation, Action onComplete, Action onStart)
{
var trackEntry = _skeletonAnimation.state.SetAnimation(_transientAnimationTrack, animation, false);
trackEntry.End += (state, idx) => onStart();
}
Can someone please explain why this is??