Hi,
Yeah, it's always tricky these cases.
This is not the most efficient solution indeed. Your fsm is hosting 90% of content that is not used, that means 90% of data to be processed for nothing. So I would strongly suggest another approach anyway, but that's of course only a suggestion
It would improve the situation to refactor because each ennemy only has to load what's truly necessary, so 10 ennemies loading 10 big fsm is always worse than 10 ennemies loading 10 smaller fsm, we agree on that right?
having global/generic approaches always backfire at some point I found. It's indeed less work up front, but ends up cornering you one way or the other, here it's perfs...
Running an Fsm using RunFSM has an impact of performance, so you need to compose around this. For sure the case should be escalated, and I would suggest your file a bug report to us, and if you can share with us this fsm, we can use to benchmark runtime fsm running and improve where possible.
Maybe you could share with me this fsm and I would propose some refactoring? I think it's a good case to work on. I am most confident it's possible to improve the situation with a refactoring. Don't think it's because I try to avoid the fact thatRunFsm has perfs impact, it's just that for you to progress, I think this is the best option, I don't think if runFsm improvements are being made, it would dramatically improve the situation, unfortunatly...
It's known that adding Component at runtime has an impact inside Unity framework, hence why there are so many pooling system, because creating objects at runtime simply takes performances out. So I think the problem here is three fold, Unity, PlayMaker and your fsm.
It's critical in every situation ( development, life etc) to be ready for refactoring
I was soooo against refactoring when I started dev, each line was so precious to me... I clearly remember how I felt when it seems your loosing precious time for something that should work... But really, in the long run, refactoring and redoing things is really a healthy practice and greatly improve your skills, as well as your project itself. I can ditch 1000's of lines and many fsm's if I think I can do it better. It's not something that should be seen as negative or taken personally. It's really a process we all go through.
So bottom line:
-- I'll forward this to Alex for a review and study how runFsm performances can be improved. Are you part of the beta? if no let me know if you are willing to participate, you could get access to these improvements quicker.
-- Don't hesitate to pm me and send me that fsm, I'll try to see how it can be designed differently to unlock you and give back some perfs to your project.
Bye,
Jean