How do i make a timeline play with a invisible trigger?
I havent found a answer quite for mine or im just simply bling but im more of a level editor and art person and am just getting into timeline i have a timeline set up were a alien idles roars then turns and runs which all plays and looks fine but i cant figure out how to set up a script so that when the player touches a invisible collider it will start playing the unity timeline but like ony once and make that trigger null and void after ive been using
using UnityEngine; using UnityEngine.Playables;
public class GenericTrigger : MonoBehaviour { public PlayableDirector timeline;
// Use this for initialization
void Start()
{
timeline = GetComponent<PlayableDirector>();
}
void OnTriggerExit(Collider c)
{
if (c.gameObject.tag == "Player")
{
timeline.Stop();
}
}
void OnTriggerEnter(Collider c)
{
if (c.gameObject.tag == "Player")
{
timeline.Play();
}
}
}
with no luck when my player touches the cube the play window pauses and says theirs no timeline attatched to the cube but it wont let me add the timeline to trigger the alien animation,
if it helps my camera style is set up like resisent evil 1 and 2 with triggers to turn 1 cam off and another for the fixed perspective look, and im trying to do the same style of trigger but with playing unity timeline to summarize it does anyone know a sample script or even a up to date video?
Answer by seant_unity · Feb 26, 2020 at 12:10 PM
The script looks correct, is there something else that could be removing the playable director component? Do you see the playable director component disappear off the trigger after the first playback?
Answer by Hellgonion · Feb 27, 2020 at 02:09 AM
it dosent dissapear by the looks of things it just seems my invisible collider trigger dosent start the timeline im using fo a cutscene of a alien roaring the turning and running into a doorway it all plays smoothly in timelines i just cant get the trigger to work
Is the playable director on the trigger or the object colliding with the trigger?
Your answer
Follow this Question
Related Questions
Starting Timline cutscene without snapping the last animation 1 Answer
Issue with timeline : gameobject's transform changed 1 Answer
Simple gameobject animation not showing in play mode (no script, Keyframes) 0 Answers
Animation timeline 1 Answer
I need help writing a script that triggers a character animation when entering a collider 0 Answers