Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: 10high on May 08, 2019, 08:28:45 AM

Title: Animating sprites: Animator vs. FSM
Post by: 10high on May 08, 2019, 08:28:45 AM
I've been using the Profiler to find performance issues and a major one seems to come from the Animator. It's bad enough that it causes a brief stutter from the frame rate drop (Android game).

My game only has simple 6-frame animated sprites that go up, down, left and right. For fun I created a prefab with 4 proxy arraylists, each holding the frames for the different animated directions. I then loop the arraylist needed, set the game object's sprite in the sprite renderer, wait 0.116 seconds (30 frames a second) and then grab the next frame.

It seems to work quite well in my simple test and I've been wondering if I should use that instead of Unity's Animator system. But I'm a noob and would really love to hear what other people think about the idea before I implement it throughout my game.

For example, I was wondering if one negative consequence would be building up Garbage by using the Wait action so often? I read that this builds up Garbage because it's an IEnumerator and is treated as an object. But I'm a noob, so what do I know?! ;)
Title: Re: Animating sprites: Animator vs. FSM
Post by: djaydino on May 08, 2019, 08:38:18 AM
Hi.
For simple usage i would use the 'animation' component. with some animation actions (like Play animation, to play for each direction)
Title: Re: Animating sprites: Animator vs. FSM
Post by: 10high on May 09, 2019, 05:04:53 AM
Thanks - I'll give that a go.