Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Rebooter on October 27, 2019, 05:34:25 PM
-
Does it affect performance a lot in actions that call GetComponent from OnEnter? I'm thinking for example of NPCs that have lots of states with PathFinding actions, so you might start getting a lot of GetComponent calls if you have many NPCs at once. I made a few custom actions that work with NavMesh agents and I added an optional NavMeshAgent object field for specifying the agent object directly. Is it worthwhile to do this?
-
It is true that those Get/Set actions should be reduced to a minimum and you should prioritize the use of dedicated actions, but that means coding them.
-
Hi,
yes, Broken Stylus is right. Cache all your components when possible by querying them at the start state, saving them into a fsmobject variable.
It's especially important in your game loop, for menu items and singular calls, you are fine though.
Bye,
Jean