- Home /
Run Unity in background on mobile platform
I know it is a question already been asked but the answers that I found are 4 years old at least.
I have an app (iOS and Android) that run a timer (handled with Time.deltaTime) when I "hide" the app by going on the home or reduce the app in any other way the whole app stops.
I'd like to know if there's a way to run the Update in background or if there's a more elegant solution to my problem.
EDIT: What I am trying to do is to run a timer, my game is a quiz game in which you have to answer within 10 seconds. So in background the timer should run normally and if it passes the time it should set the answer as wrong and go on the next question.
What are you trying to do in the background? I don't know about Android, but iOS only allows certain type of background functions.
Answer by KISP · Feb 01, 2019 at 02:09 PM
Based on your edit, I would suggest using OnApplicationPause() instead. Store the current time when the app goes to background, then compare it to the time when the app is resumed and update the timer/question accordingly.
Your answer
Follow this Question
Related Questions
How to display a video behind gui on mobile 2 Answers
Child camera transforms 1 Answer
Does Unity Pro support mobile publishing? 1 Answer
Asset Bundles with In-App Payment in Unity Mobile 1 Answer
Bake Substance for Mobile 1 Answer