Question by
Tritekstyn · May 03, 2016 at 02:50 PM ·
c#unity 5errorunity5
error CS0201
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;
}
Comment
Best Answer
Answer by TBruce · May 03, 2016 at 03:06 PM
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
}