playMaker

Author Topic: FSM performance problem  (Read 2338 times)

homeworld

  • Playmaker Newbie
  • *
  • Posts: 39
FSM performance problem
« on: August 04, 2017, 07:49:04 PM »
Hi! I've been working on a level generator for my game, and i've noticed performance issues with my (large amount of) playmaker FSMs:


The vast majority of these accomplished their goal and are just idling, never to be used again; i'm not sure what to do with them, or why they're eating up my performance in the first place!

Sending a 'finish FSM' action doesn't seem to do much, and neither does disabling the FSM via 'enable FSM';

Any tips on how to deal with the situation? Thank you!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: FSM performance problem
« Reply #1 on: August 05, 2017, 01:32:36 AM »
If you can, disable or destroy the GameObjects running the FSMs that never needs to run again. Unity has to cycle through all active GameObjects. Even if it takes a very small amount of time, it adds up if you have thousands of them!

homeworld

  • Playmaker Newbie
  • *
  • Posts: 39
Re: FSM performance problem
« Reply #2 on: August 06, 2017, 07:02:27 PM »
Neat, glad to hear it's normal and not some weird bug i stumbled across! I managed to merge all my one-shot fsms into my 'active' fsms, and cut my fsm count to about 1/3 of what it was; it should be manageable for now, and i'll look into some sort of culling system so i can only start them up when needed

Pic related, this is the culprit responsible for those 2k fsms, now happily running a lot more optimally!