Search Unity

GC.Colllect() is getting called from NetworkAnimator.FixedUpdate( ) a lot

Discussion in 'Multiplayer' started by BonyYousuf, Dec 8, 2016.

  1. BonyYousuf

    BonyYousuf

    Joined:
    Aug 22, 2013
    Posts:
    110
    Hi,
    When I am profiling I am seeing a NetworkAnimator.FixedUpdate( ) getting quite a lot of cpu usage around 21ms at times(not constantly), if I go deeper on that I see GC.Collect() is being the main culprit which is being called from that function. Does this mean NetworkAnimator is not optimized properly and creating garbage? Is anyone having this issue? And how can I fix this?

    P.S. there was no client connected, only the host was running and still NetworkAnimator was creating garbage
     
  2. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    404
    that's a lot of wasted time. Is NetworkAnimator really that bad?
     
  3. BonyYousuf

    BonyYousuf

    Joined:
    Aug 22, 2013
    Posts:
    110
    Here is a screenshot of exactly where this garbage is being created within NetworkAnimator.FixedUpdate()
     

    Attached Files: