Cleaning up managers in between Agents

wuche

Member
  • I'm trying to figure out the best way to transition from one AI Agent to another one, with an interlude in between. My current approach is to enable the AI Agent's GameObject which then creates all of its accompanying managers during runtime. Once I want to phase out the current AI agent, I disable its gameobject, but its managers still persist.

  • 1. Before I enable the next AI agent's gameobject, do I need to clean up the manager gameobjects from the previous agent? I want to avoid having to have them run persistently if I can, as I'm afraid of them using up resources.

  • 2. If I do need to clean them up, what's the best way to do that? Disable? Destroy?
Any help would be greatly appreciated! Thanks
 
Which manager gameobjects are you referring to? And by transition do you mean take control of the AI agent?
 
Sorry for being unclear. The manager gameobjects I'm referring to are:

State Manager
Object Pool (not sure why this appears, as I don't really use the objects feature of behavior designer / TPC)
Deterministic Object Manager
Behavior Manager

And when I mean transition: In the game I'm making, you battle one boss at a time. Once the boss dies, there is an intermission until the next boss appears. These individual bosses are not linked to one another in anyway and have separate behavior trees.

My concern is if I should be eliminating these 3 managers in between the time it takes for me to activate the next boss (via enabling the agent's gameobject). Or will the new agent reuse these managers and I can just leave them be during the intermission period?

I think the simplest way to phrase the question is, how do I address the runtime manager gameobjects when there are currently no active AI agents enabled? Do I leave them existing or should I clean them up until the next AI agent is enabled?

Edit: in case this helps, my TPC version is 2.0.6 and my BD version is 1.6.1

Thanks for taking a look at this Justin! Really appreciate your help.
 
Last edited:
I think the simplest way to phrase the question is, how do I address the runtime manager gameobjects when there are currently no active AI agents enabled? Do I leave them existing or should I clean them up until the next AI agent is enabled?
Just leave them be :) When there aren't any AI agents active the behavior manager will not consume any resources so you'd have more of a hit if you were to remove and then reenable it. The other managers are part of UCC and those are also good to just keep alive. You're going to run into other bottle necks way before you run into a bottleneck related to one of those manager components sitting idle.
 
Top