- Home /
Other
Big problem with movements and animations
Hi , I'm working on a 2d game for iOS and I'm stuck in a big problem. The project works really nice and smoothly in unity but when I build it for my iOS device it's awful and jerky!!! I want to know that it's because my game instances a lot of objects? Animations that i made them in unity are jerky on device too but really nice in unity! please help me , I really need this! Thanks
One obvious reason would be the difference in device power (PC vs. mobile). To be sure, run the Unity profiler and see what CPU usage you get on the PC and on mobile.
Answer by LilGames · Sep 21, 2017 at 01:38 PM
Make sure you have read and understand all the optimization requirements for mobile/iOS, like using the Sprite Packer to combine sprite graphics into one atlas, and other things that slow down on mobile.
https://docs.unity3d.com/Manual/iphone-performance.html
https://docs.unity3d.com/Manual/MobileOptimizationPracticalGuide.html
And also learn to use the profiler to see what takes the longest time each frame.
Without knowing more about your project and how you made it, it's impossible to guess where your bottlenecks will be. For example, you have not even said which device you tested on. If it's an old iphone 4 it's going to be very challenging to optimize.
If you did follow best practices and are still at a loss, I would guess you have sounds effects playing during your animations? If so, the audio decompressing on the fly will cause hiccups. You have to choose just the right sound format. I found I had to use Vorbis, Decompress on Load, and Preload Audio Data options to prevent visual hiccups when sounds play.
O$$anonymous$$G! I didn't check them before! Thank you anyway because I'm sure that my solution is that! And one more question : The best targetFrameRate for iOS is 60 fps, right?
"best" is subjective. Some people argue that 30fps is good enough for 3D visuals, while I maintain that if it's an action game and dependent on reflex style gameplay, then you need the full 60fps for smooth and responsive gameplay.
Although there are project settings for frame rate in Unity, I find I always have to add this line of code in order to get 60 fps to actually work on iOS, otherwise the device defaults to 30: Application.targetFrameRate = 60;
Thankssssssss!!! $$anonymous$$y problem is solved now!