Editing External Behavior Trees in Play Mode (without losing changes)

dangoyette

New member
My first Behavior Tree was added directly to the game object, and I was disappointed that editing the Behavior Tree in Play Mode didn't keep the changes when I left Play Mode. I figured this was because the entire tree was being serialized onto the game object, and game object changes aren't preserved after leaving Play Mode. So, I exported the Behavior Tree as an external behavior, and assigned that to the object.

However, even though the behavior tree is now an asset, I'm finding two things:
  • Changes to the Extrernal Behavior Tree during Play Mode don't actually affect the game objects using that behavior tree. For example, one of the public properties of an Action determines its color. If I change that color on the Action node during Play Mode, the game objects still use the old color. It's as if each game object makes a copy of the External Behavior Tree on Start, and they don't observe changes to the tree that might occur later.
  • In addition, the changes to the External Behavior Tree get reverted upon leaving Play Mode, meaning that External Behavior Trees don't see to be a better approach to preserving Play Mode changes. This is surprising to me, as I though Unity didn't revert changes to assets when leaving play mode.
Anyway, I was just wondering if there's something wrong with my process, and if there is, in fact, a way to modify the behavior in Play Mode, have those changes immediately take effect, and not lose the changes when exiting Play Mode?
 
When you are editing that external tree during play mode are you editing the GameObject or the actual external tree asset itself? When the external tree is loaded on a GameObject it is copied to the GameObject so the actual external tree object isn't referenced after it is loaded. I am working on version 2 of Behavior Designer and persisting changes during runtime sounds like a good feature to add.
 
Thanks. I was editing the asset itself, not the game object. I clicked the external behavior asset, clicked the "Open" button, and edited it while in Play Mode. I changed some values on some of the Actions, and adjusted some of the values on the variables. Upon leaving play mode, the values I changed were reverted. Which, again, seemed surprising to me, as I didn't think Assets worked that way. (I can edit scriptable object instances, for example, in play mode without losing the changes.)
 
Top