Search Unity

Micro Stuttering in nearly empty scene.

Discussion in 'Editor & General Support' started by zh4r0naX, Jan 28, 2020.

  1. zh4r0naX

    zh4r0naX

    Joined:
    Oct 30, 2016
    Posts:
    71
    Hi,

    iam experiencing a micro stuttering in my game, so i tried to see where it came from. While i couldnt see any things in the profiler which would directly lead me into it, i tried to remove every object.

    It was still there, in editor as in the build game.

    Ive attached a small video which shows the stuttering even in a nearly empty scene, just with a black background sprite, some vases and one object ( the book ) with a rigidbody2d attached. You can clearly see at 2 points the periodical micro stuttering kicks in.

    Are there any settings which could prevent this from happening ? I already tried to update the cameras position just in late update and fixed update, while fixedupdate seems to be right for such a setup. In this example its simply a child of the moving book.



    In the example it happens 2 times, when the first vases are reached and nearly to the end.

    I cant find the cause of this issue and its annoying me, first i thought it would be some script of mine, but i stripped out everything.

    upload_2020-1-28_18-50-33.png

    upload_2020-1-28_18-51-16.png

    Can anybody help me out ?

    Thank you for your time!
    Justin
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Are you using FixedUpdate instead of Update to move those objects by any chance?
     
  3. zh4r0naX

    zh4r0naX

    Joined:
    Oct 30, 2016
    Posts:
    71
    Books velocity is just set on start. and then nothing is applied anymore. Here is what iam experiencing in my game, stripped of everything except sprites and player.



    Found some threads talking about an unsolvable issue... i would love to find the cause of this. Oh and before you ask, iam updating the player like this in fixed Update.

    Code (CSharp):
    1.  
    2.         playerController.playerCore.rb2d.velocity = new Vector2((_movement.x * 100), (_movement.y * 100)).normalized * speed;
    EDIT:

    Oh and right now i do think the problem lies anywhere else, it looks like its based on a specific period of time. it happens each X seconds, even if i dont move the player, but the mouse for example. Animations arent effected.

    Please. If someone knows why tell me.
     
    Last edited: Jan 29, 2020
  4. zh4r0naX

    zh4r0naX

    Joined:
    Oct 30, 2016
    Posts:
    71
    Big Update:

    I found out that the stuttering just starts after playing my scene for the first time.

    Ive tested a scene from an asset ive bought with the same stuttering appearing, but only if i run my scene for one time before. After that even the scene which worked fine is stuttering periodically like in the videos above. ( If i load my project and directly play the scene from the bought asset, it works fine. If i play my game scene before, then the stuttering starts and persists in any scene which gets played after that. )

    What can be the cause of this ?

    How is that possible ? Its like there is something in my project which still remains even after the playback has stopped which gets loaded into any new scene. Is there a general info which stuff can lead into this ?

    EDIT:

    While this is not happening anymore. the problem still exists and iam getting pretty frustrated, again a whole day is gone without finding any solution. I thought it would be the GC Collector.. but even without any GC spikes its still there. Those hiccups are somehow related to the framerate.. when i set the application framerate to 60 most of them are gone, but still they are annoying as hell.
     
    Last edited: Jan 29, 2020