I have the following code for a simple pause menu with a quit button with a 2 second delay:
public Class Manager : MonoBehavior{
public Button quitButton;
void Start(){
quitButton.onClick.AddListener(TaskOnClick);
}
void TaskOnClick(){
Invoke("QuitGame", 2);
}
public void QuitGame(){
Application.Quit();
EditorApplication.isPlaying = false;
}
But it doesn’t work. Setting up QuitGame as an IEnumerator and running a coroutine doesn’t either.
Is this something you can’t do in an AddListener?