The question is answered, right answer was accepted
iOS 64 Bit - game freezes for some seconds?
I have developed a Game for Android and iOS with Unity 4.6.8, the name of game is 'CilyCube'.
CilyCube on Unity Editor work well, CilyCube for Android and for iOS 32Bit (ex. iPhone 4s) work well, but for iOS 64Bit (ex. iPhone 5s) it freezes for some second (3/5 seconds) and then returns to work without problems. Obviously after a few seconds it still freezes and so on.
The game freezes almost always in a certain range of scenes. Example: divide the scene in zone A and zone B: - in zone A the game freezes once/100 - in zone B the game freezes 90/100
When the game freezes there is not exception, or other error. The scripts of the game are the same for Android and for iOS (32bit / 64bit). So I'm thinking that it is a problem that affects IL2CPP.
I do not think the problem is the graphics, or sound because otherwise it would not work properly even on iOS 32Bit. Or am I wrong? These are days that I try to understand where it comes from the problem but I can not find a solution.
I also tried to control through Profiler Unity and through Xcode debugger. I will link the screenshots I did.
Xcode CPU on freezes:
Profiler on freezes:
Profiler on freezes (this happens a few times) Profiler 2
Profiler on freezes (Other freezes) Pofiler 3
Profiler on iOS 32Bit Profiler - CilyCube on iOS 32bit
Sorry for all of these images, but I wanted to be as clear as possible. I hope someone can help me, thanks in advance.
Can you try the same thing using the $$anonymous$$ono scripting backend? That will at least help us to narrow down the problem to an IL2CPP issue or something else.
With same thing do you mean use xCode debugger and Profiler (take screenshot), but build everything with mono 2.x? Now I try, and let you know.
Yes, that might help us narrow down the cause.
Thanks for checking on this. So it seems the issue is not IL2CPP specific then. You may want to try with $$anonymous$$etal vs. non-$$anonymous$$etal if you feel it might be graphics related. I'm a bit out of my depth there though, so I can't offer too much advice.
I have tested $$anonymous$$etal, OpenGL 2.0 and Automatic but in all of this, there is freezes. There is a method to try to understand where it comes the freezes?
The profiler is probably your best option here. Specifically, in the Instruments screen shot you included, I wonder what the spike are on thread 5 directly after the two freezes? I wonder if thread 1 is blocking on network or disk I/O during that time.
Well, figuring out what causes those peaks in the profiler is the fun part. :)
You should be able to isolate that block of time in the profiler and see what code is executing there. I suspect that the code will jump out pretty easily on thread 5, as there is nothing else going on there.
I noticed that does not always happen peak in the thread 5 after/before freezes, maybe the one before was just a coincidence. I noticed that the network stops when game freezes. I think it is the first thread to cause the problem, because every time it happens, the thread 1 brings all values to 0 (on the graph).
I also noticed that all the game continues to process information (scripts [maybe not all] runs when the game is freezes, and also the sound, works well).
This is what happens when game freezes:
I have many threads in Xcode debug; the coroutines are marked as thread in Xcode? Because they created and destroyed after a while, but in the meantime they create other.
One last question, do you think that two threads in two different scripts in the same scene, could cause problems? I use them to control the internet connection every second. (Wishing I can only use one)
So coroutines are not un on different threads. They all execute on the main thread, the same as other script code. In general, two threads on two different scripts in the same scene are not a problem. However, in this specific case something might be going on between them to cause the problem, so I would certainly have a look at them.