[BUG] Accessing bound variables on initially disabled BB fails

Forums 💬 NodeCanvas ⚙️ Support [BUG] Accessing bound variables on initially disabled BB fails

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16095
    zsoik
    Participant

      I’ve go a case where I can’t assign/read values from a bound variable on a simple “Blackboard”.

      Situation:

      • Gameobject “G” with Component “A”
      • G is initially deactivated in scene
      • Added Blackboard component to G
      • Added a variable “V” bound to the property “A”.foo
      • Other GameObject “H” with FSM
      • FSM has node with action “SetOtherBlackboardVariable” to set “V” on “G” to some value

      When this is run, the FSM will run without complaints but the property “foo” on “A” will never change.

      I guess this happens because property bindings are initialized in Awake and this blackboard never gets Awake called because it is initially disabled.

      I need to set the variable on the blackboard because I have to “initialize” the data for a component that then runs its logic as soon as it is enabled (so it can’t be enabled from the beginning). I can’t move the blackboard and component apart because I then can’t bind the property to the blackboard anymore.

      I’ll now refactor my setup to not depend on the activation state, but this took me by surprise and I had a pretty long debugging session :’D

      #16096
      Gavalakis
      Keymaster

        Hey 🙂

        Indeed, property binding for the Blackboard component, is taking place in Blackboard.Awake -> “InitializePropertiesBinding”.
        You can if you want manually call this if you need to though like so:
        blackboard.InitializePropertiesBinding(blackboard.propertiesBindTarget, false);

        Does this solution works for you? 🙂
        Thanks!

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.