Hello, and thank you for your time.
Here are the basics of what I have going on -
- player object has a .js component
that includes all player controls,
which consist of tapping to move the
player and several other features
that swipe. - There is also a pause menu object with a pauseGUI .js component
that becomes
active after a 3 finger touch. - hardware back and menu buttons on
android, are targeted to activate
the pause menu as well.
Here is the issue in detail, please read to understand the issue.
On Android it’s common to multi-task… to back out by hitting “home” and checking something, and coming back to the game. Also, lets say i’m playing… put my phone down for 30sec and phone goes into “idle” (black screen)…I’m aware Android is built to pause the app in any of these occasions, which is great… and it’s great that it resumes after returning to play, however… it seems the “touch” controls no longer work when trying to resume.
Time is still running fine, particles are active… #1 and #2 as explained above do not work… but #3 does work. So the game is running, and specific things are active, but not everything? What’s weird is I’m still able to use the buttons active in OnGui(), restart levels, go back to main and select a new level… but once i get back into any level, no touch controls work. It almost seems it’s disabled the monobehavior Update() and I have to some how force enable all components? I’ve tried a ton of things onApplicationFocus or onApplicationPause… no luck. I’ve also tried dumbing down everything on the test build, to literally 1player object, and a bg texture to fly around… same issue, so i can’t see it to be a memory/ram issue. (2d game)
#My question is, Is breaking upon resuming gameplay a common Unity bug thing?
I’ve done a ton of research and found other Unity games on android market and downloaded them… when attempted to replicate, it actually just restarts the entire game and can’t properly resume. This leaves me to start believing that Unity is incapable of resuming a game after minimizing.
If not,
#Has anyone else had experience with dealing with this? if so, what did you do to avoid this?
If anyone needed to know, this is the basis of how I go about getting touch inputs for controls -
if( Input.touchCount == 1 )
{
if( Input.GetTouch(0).fingerId == 0 )
//code here
}
thanks guys.