Performance and scripts


what is the best practice for a strategy game, is it better to have:

  • The same IA script attached to several gameobject, and work with each update function

  • An unique IA script called once, and that will browse all the gameobjects to handle ?

People have tested that and my latest info is that calling a bunch of custom update functions is faster than having the same amount of Update calls from Unity directly. Might want to just test and benchmark that for yourself though.

Having a central place to manage lots of updates gives you more control over timing either way. You might want to update the AI less often than the game’s framerate.