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.
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:
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])
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])
- Create action called "TestAction", with a `public float TestFloat = 0.0f` member
- Override "OnReset", set `TestFloat = 1.0f`
- Create new scene
- Create empty gameobject, select it
- Open Behavior Designer window
- Add "Test Action" node, which creates an entry node and adds a Behavior Tree component
- Select "Test Action" node
- Set "TestFloat" to 0 in the inspector
- Reset the action, observe that "TestFloat" in the inspector panel is now 1
- Without clicking on the field, save the scene to "TestScene"
- Open new empty scene
- Load "TestScene"
- Select the gameobject
- Select the "Test Action" node and observe that "TestFloat" is 0 again