- Home /
how to pause the game on background
hi everyone i found this once but cant remember what or where it was.
basically im looking for the reference for when an iphone app is sent to the background or minimised, so that i can enable my pause script. but i cant remember what it was called to look it up
Answer by flamy · Aug 09, 2012 at 02:47 AM
void OnApplicationPause(bool _bool)
{
if(_bool)
{
print("paused");
}
else
{
print("resumed");
}
}
This snippet worked for me. I got a call back when the app went to background and also when i came back to the game. with true and false as parameter respectively. But i tested it only on android not ios. still im pretty much confident that it would work.
cool i will give it a try in a $$anonymous$$ute, when i do a build
yh it works nice one, now its stored in my own reference database... unity answers.
good to know its the same for android as well
Your answer
Follow this Question
Related Questions
Pausing during in-app purchase 0 Answers
Displaying background layers effectively on iPhone 0 Answers
Odd "waterfall" or smearing error in background 1 Answer
Pause Menu Audio 1 Answer