Hello guys can anybody please tell me how to play a timeline through script and give it a condition after which it will play?
Turn off ‘play on Awake’ on the PlayableDirector. Then, have a script something along the lines of the following:
public class MyBehaviour : MonoBehaviour
{
public PlayableDirector playableDirector;
public bool conditionMet {get;set;}
void Update()
{
if (conditionMet && playableDirector != null)
{
conditionMet = false;
playableDirector.Play();
}
}
}
There are of course many variations - how the condition is met, the playableDirector might be on the same gameObject as this script - but hopefully this gives the general idea.
Thank you so much