Task "Reset" button does not save changes

bdg_toast

New member
This doesn't seem like it would be intended behaviour, so I'd call it a bug. But if it is intended behaviour, please consider this a feature request.

1669271579125.png

The "Reset" button, which calls `Task.OnReset`, does not seem to save changes to the task data after execution. My expectation would be that reset calls `OnReset` and then saves any changes, like it would if I were to edit it in the task inspector.

I could manually save changes by calling:
C#:
var owner = Owner.GetObject();
Undo.RecordObject(owner, $"Reset task {FriendlyName}");
BehaviorDesignerUtility.SetObjectDirty(owner);
BehaviorDesignerWindow.instance.SaveBehavior();

Having to do that manually every time I override `OnReset` seems redundant when the caller could do it, it's error prone since it's easy to forget, and it's really annoying.

Repro (Unity 2021.3.3f1) (BD 1.7.4 [runtime source])
  1. Create action called "TestAction", with a `public float TestFloat = 0.0f` member
  2. Override "OnReset", set `TestFloat = 1.0f`
  3. Create new scene
  4. Create empty gameobject, select it
  5. Open Behavior Designer window
  6. Add "Test Action" node, which creates an entry node and adds a Behavior Tree component
  7. Select "Test Action" node
  8. Set "TestFloat" to 0 in the inspector
  9. Reset the action, observe that "TestFloat" in the inspector panel is now 1
  10. Without clicking on the field, save the scene to "TestScene"
  11. Open new empty scene
  12. Load "TestScene"
  13. Select the gameobject
  14. Select the "Test Action" node and observe that "TestFloat" is 0 again
This seems to happen regardless of if the tree is external or not.
 
Thanks for the report. Yeah, it should persist the changes. I have fixed it on my end and can send you a new editor.
 
Top