- Home /
Question by
Razputin · Jan 29, 2017 at 05:30 AM ·
functioneventeventsystemfunctions
Fill out Event Trigger from Script
I'm trying to put a function into my event trigger from script but I don't understand how.
basically I have a function I want to place in the event trigger on every level without having to go through each level and manually select it.
How do put the function into my event trigger?
returnToTitle = GameObject.Find("Return To Title");
//Here I tried things like
returnToTitle.GetComponent<EventTrigger>().OnSubmit = ReturnToTitle();
returnToTitle.GetComponent<EventTrigger>.OnSubmit("ReturnToTitle");
returnToTitle.GetComponent<EventTrigger>.OnSubmit(ReturnToTitle());
public void ReturnToTitle() // function I want to call on submit
{
SceneManager.LoadScene("MainMenu");
}
Sorry for wording this really poorly I don't even really know how to describe this. I only use the UI system like once a year when I'm wrapping up a project so I don't have a great grasp on it.
Comment