- Home /
Question by
DanaScully · Dec 05, 2016 at 11:19 AM ·
pausepause game
Exit play mode with framecount/scripting
I am currently running a simulation which depends on the frame count. I would like to exit play mode when I have reached a certain frame so that the simulation stops automatically. My Update function looks like this:
void Update()
{
//----code related to simulation, works fine--------
//------------ pause when certain frame is reached
if(Time.frameCount == 40)
{
//----- Pause ?
}
}
I have tried Application.Quit() but it seems it is not the answer to my question.
Comment
Answer by Dyougi · Dec 05, 2016 at 11:32 AM
Application.Quit() is ignored when playing in the editor. It should work if you make a build and play it.
Your answer
![](https://koobas.hobune.stream/wayback/20220612102055im_/https://answers.unity.com/themes/thub/images/avi.jpg)