Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Unity? wazzup, Our game is stuttering! i thought your software is good.

Discussion in 'Editor & General Support' started by eanjo7, Jun 21, 2014.

  1. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    I search the web on my problem regarding to stuttering my game in mobile android ( mine is s3 )
    and I found this forumn

    http://forum.unity3d.com/threads/stuttering-issue-on-unity-4-2.203552/page-2

    First of all I created a 2d sidescrolling game, the game looks perfect as I develop it.

    then I tried to build it on android apk and install it in my s3.

    then hiccups comes out, and stutter continues when I test it after installation.
    The players will definitely piss off, cause my game is sidescroller!! and hiccups will destroy the gameplay! :(

    Im using unity 4.5, but other sed it happens too in 4.2,

    well we are paying tons of money to develop on this software, and stuttering is a VERY MAJOR PROBLEM.

    hope unity can solve this. btw in my previous work in unity 3.5 it doest stutter. and other sed that as well,
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Did you try to analyze what the cause of the stuttering is?
     
  3. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    no idea tried other things that people said in the forumn, but still has it. check the forum link that i post. some said they try everything to it.
     
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Trying things that other experienced is not necessarily what helps you. That's why I am asking whether you analyzed your application, maybe checked the profiler if you have Unity Pro, checked where some expensive operations may be, ...
    It doesn't matter what others are saying, if you want to get it sorted out for your application, that's where you have to look.
     
  5. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Men, as if i didnt check it X)
    I tried everthing, turning off the vsync, test the fixed update, etc. I try to download a new unity just to test it! cause before Im using 4.2, then I downloaded 4.5 just to see if still stuttering.


    and men thats why we have this forum to share experiences to what problem we encounter. so that looking others experience to a certain problem will definitely help us :D right?
     
  6. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    Since you checked the profiler you should know what is causing the spikes.
     
    snowcult likes this.
  7. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
  8. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    We still haven't determined that you are facing the same problem as that thread. Does the profiler show large spikes of overhead? Or are the spikes caused by something else?
     
  9. chrisall76

    chrisall76

    Joined:
    May 19, 2012
    Posts:
    667
    Yea, check the profiler.
    But yea, Unity seems to be a bit weird on some galaxy phones (heck, it crashes on my galaxy Epic once I quit the game).
     
  10. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Guys thanks for all the help, but for what I'm experiencing is the same as what other people experiencing.
    I already check the profiler again and again, in my profiler the highest on it is the waitForTargetFPS.

    AS I sed I already tried everything I see as I searched all over the internet.
     
  11. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Post a screenshot of the profiler view attached to the game running on the device.
     
  12. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    waitForTargetFPS doesn't tell us anything though, all that means is you are getting better performance than your target FPS at those times. As Ostwind said a screenshot of the profiler would be best.
     
  13. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Post a image of the profiler...we need see more to help
     
  14. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Hi I attached the profiler, which as you see, the highest and the most inconsistent is the WaitFortargetFPS. I think thats reason for the hiccups, cause in my previous game on unity 3.5 the overhead is the highest.
    some sed to disable the vsync, but no effect, its still the same! I do the Application.targetFrameRate = 60; thats the best, as other said making it to 35 will be like 15 or somthing so laggy, I ALREADY TRIED IT. hope someone can help me DIRECTLY. thanks
    PROOF.png
     
  15. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    What is that spike on the CPU near on the right of the graph ? have you looked at it ?

    Also, is it the profiler while running the app on your phone or in editor mode ?
     
  16. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Yeah are those stats really from mobile device or are you profiling the game in desktop editor play mode?

    BTW there seems to be a lot of transparent stuff on gpu view which with much overdraw could be performance killer on mobile
     
  17. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    975
    WaitForTargetFPS is just VSync and those dips in it, along with the associated GPU spikes, are the editor and profiler windows refreshing. You should connect to the profiler *on the target device*, not on the editor like you have.
     
  18. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Hi thanks all for the replies, but how can I do that?
    other android devices cannot do build and run, like my s3, is there an emulator for that?
     
  19. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    975
    You do not need to do build and run to use the profiler, if you have an Android Pro licence you can connect with any device running your game, if it has been built with "Development Build" enabled in the build options. If the game is running on a device on the same network as your editor, it will be picked up if you click "Active Profiler" in the profiler window.
     
  20. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Hi sorry for not knowing that, heres the profiler active on mobile. I uploaded the 3 samples of highest spikes I see.

    prof2.png

    prof3.png

    prof1.png
     
  21. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
  22. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    ANY direct answers? what's causing the main problem? oR THERES NO SOLUTION AS OTHERS EXPERIENCE IT???
    men, unity is not a good thing. I remember the lag and stutter of Minion Rush, which maybe developed too in UNITY
     
  23. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    There are no general answers as each game and code is its own. You can now see from your profile that there are spikes where total frame time goes up a lot and only you know whats happening there. Also you could try enabling deep profile from the top. We need more screenshots or info to work with.

    So far nearly everything seems to say its graphics related (draw calls are low which is good but how about fill rate? How much overdraw you have on the frames when it stutters? screenshot maybe? in editor its in the 2nd dropdown where default is RBG. Lots of bright color and everywhere on screen is mobile killer.
     
  24. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    AS I SED, the stuttering happens to others too, like in the forum link i pose here.
    It doesn't happen in my unity 3.5 version only in 4 and above.
     
  25. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You are right that the stuttering happens to others as well, but you still didn't try everything to be sure you are encountering the same issue. E.g. the previous post from _met44 is very productive and points you in the right direction. Those could easily lead to stuttering as well.
     
  26. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    @eanjo7 - I am sorry you spent at least $3000 on software, and have concluded that the spikes your game has are because Unity is not good. When I looked at your first profiler screenshot, it looks to me that it is physics which pushes the spikes up. At least, the spikes seem to have a lot of orange in them. I can't easily work out the colours on your second and third screenshots, but possibly they're showing "Others". Device.Present and Clear suggest that Unity is waiting for the GPU to finish what it was doing before being able to complete the current frame. I suspect if the CPU gets too far ahead of the GPU then it'll sit and spin.
     
  27. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    no problem its just 3000 dollars. :D I can buy lots of thing in that. XD just kidding.

    Im not the only one, whos encountering that.
    And Im wondering why in unity 3 its not that cause I develop there before.
    and in unity 4+ its stuttering.

    I have a game which is build on unity 3.5 and then I open it on unity 4. then the sutter comes out. its a 2d sidescroller game too.


    I am very nervous that I cannot solve this problem. cause I cannot release it like this. the players will get piss off.
    the run and jump style / avoid obstacles of my game will really be destroyed if the game stutters.

    whats the meaning of the gpu/cpu your saying?

    what should I do? Im using c# even in the start which has no fixedUpdate to use, still stutters. :(
     
  28. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Well, if you think it's a bug in Unity submit a bug report. If the community is unable to help you, then purchase a support contract. Complaining here that Unity isn't working for you really isn't earning you much respect. Game development on mobile devices isn't trivially easy. Lots of customers have submitted games to the App and Play stores so making a game with Unity is possible. No-one wants you to release a game that isn't fun to play. Do you see the same behaviour from the 2D tutorials on the Learn site? Does the stuttering happen on every device you have deployed to?

    I'm no android expert, but on iOS the CPU and GPU are decoupled. The CPU can work on frame N while the GPU is rendering frame N-1. If the CPU can generate a frame faster than the GPU can render it, then the CPU can spin waiting for the GPU to catch up. I'm not saying this is absolutely what's happening for you, but in your third screenshot, perhaps the CPU cannot call Clear because the GPU is still using it. As I said, mobile development is hard, and just because your game is not working as you want does not automatically mean Unity is at fault. You *might* be hitting a bug in Unity, I don't know, but it's impossible to work that out remotely.

    Do you agree that the first profiler screenshot shows spikes in physics? The colours are so weird I am not sure I can read the profiler correctly.

    Finally, the most common reason for spikes in games is because the garbage collection is deleting unused assets. If your game is using object pools, then you're probably not experiencing this. The docs do have lots of help and advice about mobile games. See:

    http://docs.unity3d.com/Manual/iphone-iOS-Optimization.html

    and

    http://docs.unity3d.com/Manual/MobileProfiling.html

    for example.
     
  29. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Sorry for my honest complaint I really love developing in unity thats why it hurts me. seeing it like this in my mobile now, cause before its not like that. so Im quite upset.


    I already using object pooling, the game stutters on the device galaxy s2 and galaxy s3, but in the galaxy tab. it doesnt.
    I have no idea in the first profiler if thats a physics or something.

    Maybe I will start a new project and test it again and again as every new thing I put. so I can catch whatever it will be.

    thanks again for the help.
     
  30. jamie-lowes

    jamie-lowes

    Joined:
    Jul 5, 2012
    Posts:
    47
    I'm seeing similar things on a Samsung Galaxy S4.

    My scene is super simple. I'm drawing 10 sprites, that scroll left and right with a sin wave offset. On top is a super basic NGUI UI, 8 texture widgets.

    I have set the target frame rate to 60, and turned vsync on, with an interval of 1. I update the sprite positions in an Update function in a manager script. I move my time variable a fixed amount, so it's not a Time.deltaTime thing. There are no physics in use, so it's not an interpolation issue.

    In the editor, on a Macbook Pro, the 'game' is perfectly smooth. Both in game view and scene view.

    On the S4 it's smooth for a bit, but with big stutters every second or so.. I connected the profiler and saw similar things to the above poster, overhead and present.

    My bug report: Set up a simple scene with a constant, slowly scrolling background. Run on an S4, observe stuttering!
     
  31. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    975
    I may be misunderstanding you but surely you would want your time to be incremented by deltaTime or at least scaled by it, otherwise any fluctuations in framerate will result in actual changes in your game speed and stutter.
     
  32. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Hmmm.. Im overserving what it may cause, Im started to blame the iTween that I uses for x position.
    maybe the problem is not for what we see
     
  33. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42

    so what happened next?
     
  34. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    Give a try to GoKit then, seems a lot more recent and powerfull than iTween. (it's opensourced on github & free on the store).
     
    eanjo7 likes this.
  35. jamie-lowes

    jamie-lowes

    Joined:
    Jul 5, 2012
    Posts:
    47
    Normally, yes. But this isn't a game yet, it's 10 sprites and 8 rectangles. This phone can do that in well under a 60th of a second!

    Given that it is so basic, I decided to eliminate Time.deltaTime as a potential problem by updating by a fixed amount per frame, ( 1.0f / 60.0f ). But it had no effect. The 'game' runs at 60 for the most part, but with a periodic stutter. Each frame draws the same number of meshes and triangles and pixels, there's no reason for one frame to vary all that much from the next.

    I think given my findings, and the numerous other people complaining about it - complete with minimal scenes that also stutter - I think that Unity has trouble maintaining a consistent frame delivery interval on some devices.

    One thing I have noticed is that it runs smoother in a dev build with the profiler connected than it does as a release build without the profiler....?! That points to a bug.
     
  36. jamie-lowes

    jamie-lowes

    Joined:
    Jul 5, 2012
    Posts:
    47
    I've found what's causing it.

    Looking around for others with the problem, some people state it goes away if you're touching the screen, and it does. If I run for a second or so I start seeing the stuttering. If I then drag my finger round in circles on the screen it starts running perfectly smoothly.

    So, is there a way to force the game into a high priority mode...? Seems like the app drops priority if it's not being touched all the time. I wonder how this affects tilt based games...?
     
    MGleem likes this.
  37. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Not sure for your findings in the touch scenario, or neither in you profiler observation.
    this is a main problem as you sed in UNITY, ( I think that Unity has trouble maintaining a consistent frame delivery interval on some devices. )

    as I sed again it doesnt happen to me in 3.5
     
  38. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    We can chat about Android and iTween and whatever you guys want. If you want some action from Unity, then submit a bug report with a small repro case, and post the case number here. We have around 40 people in our QA team who process bug reports, and feed real problems into the R&D team for fixing.
     
  39. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Hi thanks, this is my first time to this, what should I do first? are we going to chat with a developer for a fix?
     
  40. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    I can hook you up with one of the engineers. That costs $350/hour. I assumed you'd submit a small repro case that shows the problem you have, and the identity of the device where you see the problem. Our Android QAs can then investigate for you. Note that it is critical that you identify exactly the device where you see the problem. Use:

    $adb shell cat system/build.prop
    build fingerprint

    It's not enough to say it happens on an S3, since different parts of the world have different hardware, and different carriers install different drivers.
     
  41. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Hi thanks I appreciate your offer and help. but Im just an indie developer. I have no budget for it.
     
  42. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    So submit a bug report and get the QA team involved. That's free of charge.
     
    NomadKing likes this.
  43. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Hi just an update here regarding to the stuttering.

    The stuttering in android decreases after I updated the unity to 4.5.1p3

    I dont know how, or if they change something, but it decreases the hiccups/lag.

    it only stutters at first installation and after a few game, it comes smooth.

    try it here
    http://forum.unity3d.com/threads/unity-patch-releases.246198/

     
  44. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Can you do some more testing, because the chaneglog in p3 is small, did you use p2 before or p1?
     
  45. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    No i didn't download both p2 and p1, Is it all that updates there also in the p3?

    I test over and over, the true lags and hiccups is strong after installing and playing the game.
    but when you play it long, it become smooth, but, there still stutters maybe 20 to 30 interval but not as bad as before.
     
  46. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You seem to insist on not reading the advice given, but this is probably a language barrier. Some tips:

    - all moving colliders must have rigidbody or there will be an expensive delayed cost which can cause stutter.
    - all "GC Alloc" must be minimised and removed by programmer effort or you will get stuttering.
    - Do not use Instantiate and Destroy, it causes GC Alloc etc. Use pooling instead.

    This is normal way to develop on mobile.
     
  47. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    thanks for the tips about the collider, what is better, using rigidbody2d or the normal rigidbody?
    it may have a cause of the stutter? and what is better 2d collider or the default one?
     
  48. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    975
    Completely different physics systems, if you are making a game that is strictly 2D, use Rigidbody2D and 2D colliders. Make sure that you do *not* mix the two systems, the 3D one is PhysX while the 2D one is Box2D, they are separate.
     
  49. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    yes Im using both 2d rigidbody and 2d colliders, Im trying now if the stutter will thoroughly and magically disappear (I HOPE)
     
  50. eanjo7

    eanjo7

    Joined:
    Jun 1, 2014
    Posts:
    42
    Hi, another thing, try this it 80% decreases the hiccups!!!
    the default is 0.02 Fixed timestep and 0.033 Maximum allowed time.
    make it both 0.02 and 0.02 here:
    tm.png