playMaker

Author Topic: Animating sprites: Animator vs. FSM  (Read 180 times)

10high

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Animating sprites: Animator vs. FSM
« on: May 08, 2019, 05: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?! ;)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4440
    • View Profile
    • jinxtergames
Re: Animating sprites: Animator vs. FSM
« Reply #1 on: May 08, 2019, 05: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)
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

10high

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Animating sprites: Animator vs. FSM
« Reply #2 on: May 09, 2019, 02:04:53 AM »
Thanks - I'll give that a go.