Hello Guest

Author Topic: tk2SpriteAnimator.LateUpdate() Very High CPU Impact !!  (Read 4515 times)

erfan71

  • Newbie
  • *
  • Posts: 2
    • View Profile
tk2SpriteAnimator.LateUpdate() Very High CPU Impact !!
« on: February 21, 2014, 08:52:49 am »
Hi !.
I use Unity Profiler to test my Performance ,  i See that tk2SpriteAnimator.LateUpdate() have a vary High CPU Time , and i worry about it . it some times goes up to 1.2 ms !!!!
I just Have 2 SpriteAnimator in my Scene.
One for Runner Player , and the other for coins that Rotate in the Scene . ( i see 4 up to 5 coins at the same time in the camera )
How can i Optimize this function ?
reduse the frameRate? Reduse the Atlas Sizes? 

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2SpriteAnimator.LateUpdate() Very High CPU Impact !!
« Reply #1 on: February 21, 2014, 10:40:12 am »
Is it allocating any memory at that point? One reason for it to allocate memory is if you're using sprite dicing, etc on the sprite. You don't want to do that on animators unless you can handle the overhead. Also, is it REALLY the animator, and not the garbage collector, etc underneath it?

I can't say I've seen 1 or 2 sprites causing issues like that. Try the tile map demo, there are LOADS of coins there.

erfan71

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: tk2SpriteAnimator.LateUpdate() Very High CPU Impact !!
« Reply #2 on: February 22, 2014, 06:16:34 pm »
No, My animation are not Dice.  but they are a little complex , about 30 images.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2SpriteAnimator.LateUpdate() Very High CPU Impact !!
« Reply #3 on: February 22, 2014, 10:37:17 pm »
Number of images shouldn't really matter, unless you're constantly swapping materials because you're using spanning.
How many sprite animator.update does the profiler report? You say you had 2 in the scene, but then you say you have 4-5 coins rotating as well so it can't be 2 can it?