Blackboard Variable changed condition

NodeCanvas Forums Support Blackboard Variable changed condition

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12839
    sinzer0
    Participant

    I’m trying to create a condition task that returns true when a BB variable changes. Everything works except OnDisabled gets called after the transition in a FSM. So in this case where should I unsubscribe from the OnValueChanged event to clean up the event listener?

    #12846
    Gavalakis
    Keymaster

    Hello and sorry for the late reply.

    I have modified your code to work as I expect you want it to:

    Some notes:
    – Use OnInit only for initialization similar to Unity’s Awake.
    – Use OnEnable and OnDisable to subscribe and unsubscribe.
    – You don’t have to call base implementation of methods.
    – A BBParameter will never be null. Use .isNone to determine if the front-end user has selected a variable or not.

    Let me know if that works for you.
    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #12847
    sinzer0
    Participant

    Thanks that works now for normal conditions but I did notice one issue. When the condition is part of a Concurrent node OnEnable is not called but OnInit is. Thus the condition does not work in Concurrent nodes because the event never gets setup.

    Not sure if that is a bug or working as intended?

    #12854
    Gavalakis
    Keymaster

    Hello and sorry for the late reply.
    You are correct. This is actually a bug in the Concurrent Node.

    To fix this, please open up ConcurrentState.cs file and:
    1) In the OnEnter Method, add this line of code above everything else:
    conditionList.Enable(graphAgent, graphBlackboard);

    2) In the OnExit method, add this line of code first as well:
    conditionList.Disable();

    Thanks for the report!

    Join us on Discord: https://discord.gg/97q2Rjh

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