Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: homeworld on August 04, 2017, 07:49:04 PM

Title: FSM performance problem
Post by: homeworld 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:
(https://puu.sh/x1QcP/4dc8a2d01a.png)

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!
Title: Re: FSM performance problem
Post by: Alex Chouls 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!
Title: Re: FSM performance problem
Post by: homeworld 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!

(https://puu.sh/x3srE/09cf82d28a.jpg)