Skip to content

Instantly share code, notes, and snippets.

@wiverson
Created January 21, 2020 17:02
Show Gist options
  • Save wiverson/5a7175fab15c96b4e9e192eb3b2acfb7 to your computer and use it in GitHub Desktop.
Save wiverson/5a7175fab15c96b4e9e192eb3b2acfb7 to your computer and use it in GitHub Desktop.
Reset a Unity3d PlayableDirector / Timeline
using System;
using UnityEngine;
using UnityEngine.Playables;
public class ResetTimeline : MonoBehaviour
{
public PlayableDirector playableDirector;
private void Start()
{
if (!playableDirector)
throw new ArgumentException("Missing Playable Director");
}
public void ResetPlayableDirector()
{
playableDirector.Stop();
playableDirector.time = 0;
playableDirector.Evaluate();
playableDirector.Play();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment