Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Pause and Resume rendering

Discussion in 'Project Tiny' started by Ekskursantas, Jan 15, 2019.

  1. Ekskursantas

    Ekskursantas

    Joined:
    Feb 12, 2017
    Posts:
    1
    Hey guys, so I am in search of a way to pause and resume rendering. Basically, I want to pause rendering of the game when it is minimized (in background) on mobile phone. I have the trigger to do so when the game is minimized, but I am not sure how to pause the rendering it self. Should I just stop the main loop somehow or is there more correct way?

    P.s Hope I explained the issue well enough. Otherwise please ask questions so I can elaborate more on the issue, I am not the finest speaker. :)
     
  2. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
    There's
    Time.timeScale
    , which will pause or un-pause your game. Unity UIs won't be affected by this, I think.

    Time.timeScale = 1;
    means your game is playing normal
    Time.timeScale = 0;
    means your game is paused

    This tutorial from sitepoint could also help.
     
    Last edited: Jan 16, 2019