Quasimodem
New member
Hello, I have seen this question posed a few times on the forums but still haven't found the proper resolution.
I'm looking for an alloc-free way of Enabling/Disabling my BehaviorTrees. Each of my BehaviorTrees has its own ExternalBehavior, which has been instantiated and Init()ed up front. All the best-practices seem to be in place, yet I still see a little garbage created every time I call EnableBehavior() to pull my object back out of its pool.
If I turn on the deep profiler, I can see a call to Activator.CreateInstance() down deep in the stack, which seems to be the main culprit.
Is there hope for my situation? I've tried playing around with all combinations of PauseWhenDisabled, BehaviorManager.instance.RestartBehavior(), etc, but I seem ultimately unable to avoid a call to EnableBehavior().
If there's a way to have a GameObject activate and then either restart each of its BehaviorTrees or have them pick back up where they left off, without allocating, I'd love to find it!
Thanks in advance -
I'm looking for an alloc-free way of Enabling/Disabling my BehaviorTrees. Each of my BehaviorTrees has its own ExternalBehavior, which has been instantiated and Init()ed up front. All the best-practices seem to be in place, yet I still see a little garbage created every time I call EnableBehavior() to pull my object back out of its pool.
If I turn on the deep profiler, I can see a call to Activator.CreateInstance() down deep in the stack, which seems to be the main culprit.
Is there hope for my situation? I've tried playing around with all combinations of PauseWhenDisabled, BehaviorManager.instance.RestartBehavior(), etc, but I seem ultimately unable to avoid a call to EnableBehavior().
If there's a way to have a GameObject activate and then either restart each of its BehaviorTrees or have them pick back up where they left off, without allocating, I'd love to find it!
Thanks in advance -