error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
it only happens when i put this
public void ExitOn()
{
Application.Quit;
}
error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
it only happens when i put this
public void ExitOn()
{
Application.Quit;
}
It needs to be
Application.Quit();
Not
Application.Quit;
You should try this out
// public function to remove player life and reset game accordingly
public void ExitOn()
{
#if UNITY_EDITOR
// Application.Quit() does not work in the editor so
// UnityEditor.EditorApplication.isPlaying need to be set to false to end the game
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}