Repeater not repeating after scene switch

Banjolasse

New member
Hi there!

I have a very simple tree: Entry -> Repeater (set to forever) -> Log
In the starting scene, an object with this behavior logs the console forever. When I load another scene (in runtime) containing an object with the same behavior, the behavior logs once and then shuts off. Is this intended, and if so what's the workflow when loading scenes?

Thankful for any help.
 

Justin

Administrator
Staff member
Are you using DontDestroyOnLoad? If so you'll need to make sure you also don't destroy the BehaviorManager.
 

Banjolasse

New member
Thanks for the answer, Justin.
I added the BehaviorManager to my persistent gameobject, but it still does not work. In fact, now it does the log action zero times instead of once :)

I'm clearly missing something here. This is what the behavior looks like after scene loading. That repeater is still set to forever.

problem.PNG

Edit:
I tried to only do the [entry->log] as well, but that is also not run. The log does have that green checkmark on it, though.
 
Last edited:

Banjolasse

New member
Alright, after a lot of fiddling I got it to work, with a slight caveat.

I was having the Behavior Manager on an object that had a singleton script on it, and this broke it for some reason. I moved the Behavior Manager to its own object and made it persistent with DontDestroyOnLoad.
Now it works, but loading to a scene and then back into the starting scene (where the Behavior Manager instance was created) will create a duplicate Behavior Manager object. Still works, so I assume the old version is inactive?

Anyway, I suppose this won't matter in the long run as the Behavior Manager object will be created in a loading screen.
 
Top