Custom behaviour - a bug?

Hello,

After editing and saving custom behaviour’s .json file, the leaf in behaviour tree view does not get updated even after reloading the window - swapping the customer behaviour leaf with the same one seems to fix the problem.

-R

Hi @Radim,

This is an expected behavior with some custom behavior’s options properties, but not others.

  1. Changes made to defaultValue property are not expected to affect existing instances of your custom behavior unless you swap the behavior or add a new instance of the behavior. This is to prevent inadvertently overwriting and breaking your previous code.
  2. Changes made to description and field properties will update the Behavior Arguments pane UI when reloading.

Let me know if this is different from what you are seeing on your end and I’ll be happy to dig into this further.

Hi Joe,

Thank you for the details. I experience the problem when I add or remove element in the options array.

-R

@Radim - It sounds like we are on the same page and I want to make sure what you are seeing is an expected behavior when adding or removing options from custom behaviors. Adding or removing new options are not currently expected to cascade to all existing instances of your custom behavior, only to new instances of your custom behavior.

Adding new options to existing custom behaviors

Adding new eyeScale option to custom behavior, center-robot.js

Adding new eyeScale option to custom behavior, center-robot.json

New eyeScale option not present in existing instance of CenterRobot behavior in 21-take-photo.bt even after reloading dev window. Only if we add or swap a new instance of the Center Robot behavior are we are expected to see the new option changes.

We can see what is happening behind the scenes with the code generated in the json version of the behavior tree.

Close your 21-take-photo.bt file and right-click 21-take-photo.bt -> Jibo -> Open as JSON

The code was already generated for all existing instances with the previous options, even though we added the new eyeScale option to both center-robot.json and center-robot.js, and the custom CenterRobot behavior already exists in the 21-take-photo.bt.

Animated Gif showcasing this:

Removing existing options from existing custom behaviors

If you remove an option previously available for existing instances of your custom behavior, this option will still be displayed for your custom behaviors, however when you reload, your existing custom behaviors will recompile and throw TypeError: Cannot read property 'type' of undefined errors until you replace these with a newer instance of your custom behavior:

If you are seeing something differently when you are adding or removing options from custom behaviors, please let me know and provide screen shots or source code so I can take a closer look at this for you. If this is what you are seeing, this is an expected behavior and is intended.

I understand these changes can be handles more gracefully and I passed this along to our team so we may take this into consideration for future releases of our SDK :slight_smile: