Skip to content

RandomizedComposite weights getting reset after switching nodes in the editor #328

@ksmithdev

Description

@ksmithdev

Godot version: v4.2.1.stable.mono.official [b09f793f5]

Describe the bug
The weights for SelectorRandomComposite (and I assume SequencerRandomComposite) get reset to 1 after switching away and back to the node.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project
  2. Install the latest beehave plugin
  3. Create a Node3D
  4. Add BeehaveTree and Blackboard nodes
  5. Add a SelectorRandomComposite to the BeehaveTree node
  6. Add three ActionLeaf nodes to the SelectorRandomComposite node
  7. Check the Use Weight property on the SelectorRandomComposite and set the weight for the 3rd node to 10
  8. Create a Game node and add the Node3D node created above
  9. Check weights for SelectorRandomComposite and see they're all back to 1
  10. Reset 3rd weight to 10
  11. Switch back to Game node
  12. Switch back to Node3D and see they're all back to 1 again

Expected behavior
Setting weights in a RandomizedComposite should never reset unless changing the number of nodes.

Screenshots
image
image
image

Desktop (please complete the following information):

  • OS: Windows
  • Edition: Windows 11 Home
  • Version: 23H2
  • OS build: 22635.3447

Additional context
The issue might be in the RandomizedComposite root node when _on_child_exiting_tree is called. The child looks like it's being removed and the weights are being reset?
https://github.com/bitbrain/beehave/blob/godot-4.x/addons/beehave/nodes/composites/randomized_composite.gd#L127-L129

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions