If your Engine: Control Timeline Action has Wait until finish? checked, and at least one of the Timeline's tracks is bound to a character, then OnCharacterEnterTimeline and OnCharacterExitTimelineevents will be triggered for that character at the beginning and end of the Timeline's playback.
You should be able to use this to determine the difference, e.g.:
using UnityEngine;
using UnityEngine.Playables;
using AC;
public class TimelineChecker : MonoBehaviour
{
bool isInTimeline { get; private set; }
void OnEnable ()
{
EventManager.OnCharacterEnterTimeline += OnCharacterEnterTimeline;
EventManager.OnCharacterExitTimeline += OnCharacterExitTimeline;
}
void OnDisable ()
{
EventManager.OnCharacterEnterTimeline += OnCharacterEnterTimeline;
EventManager.OnCharacterExitTimeline += OnCharacterExitTimeline;
}
void OnCharacterEnterTimeline (AC.Char character, PlayableDirector director, int trackIndex)
{
isInTimeline = true;
}
void OnCharacterExitTimeline (AC.Char character, PlayableDirector director, int trackIndex)
{
isInTimeline = false;
}
}
Comments
If your Engine: Control Timeline Action has Wait until finish? checked, and at least one of the Timeline's tracks is bound to a character, then OnCharacterEnterTimeline and OnCharacterExitTimeline events will be triggered for that character at the beginning and end of the Timeline's playback.
You should be able to use this to determine the difference, e.g.:
in that case should I put a dummy character on a track and leave it empty?
thanks
Yes, that would be a good workaround for the above script.
But if you know which Timeline you want to check for, you can instead just read the PlayableDirector component's state value: