ConditionTask Methods

NodeCanvas Forums Support ConditionTask Methods

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #13232
    atmuc
    Participant

    ConditionTask should have OnExecute, OnStop methods. I use event listener in a ConditionTask. I subscribe and unsubscribe to events. Is there any workaround for this? I can use a bool to catch the first update and subscribe event. There is no method for stop to unsubscribe.

    #13248
    Gavalakis
    Keymaster

    Hey,

    If you are referring to ConditionTasks executed in the context of an FSM (transitions), then you can use the “OnEnable” and “OnDisable” overrides for this.

    In the context of Behaviour Trees and because a ConditionTask, has no proper time in which it can be considered “enabled/disabled”, the overrides are not called, but I am thinking that for the shake of consistency, they should be when the Behaviour Tree starts and stops respectively.

    Let me know what you think.
    Thanks!

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

    #13256
    atmuc
    Participant

    onenable and ondisable can cause undesired behaviours. there should be a function that runs just before first checking the condition. and there should be an exit function that runs just after the success case. also, ondisable should call exit function if the condition is active. onenable and ondisable are related directly to the gameobject. you can activate gameobject before using condition. maybe you never use condition buy you can enable condition game object. similarly, you can disable game object lately or you can cache it. so there should be functions related condition.

    #13268
    Gavalakis
    Keymaster

    Hey,

    OnEnable and OnDisable method in Condition tasks don’t share the same calling way of OnEnable and OnDisable of Monobehaviour if that is what you meant. In the context of FSM, OnEnable and OnDisable will be called pretty much when you describe:
    – OnEnable, will be called once the parent state gets active and just before the first check.
    – OnDisable, will be called once the parent state exits.

    Please let me know if I misunderstood what you meant.
    Thank you.

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

    #13274
    atmuc
    Participant

    Hey,

    No, it is not what I want. currently; when I set transition condition to “check after state finished”, onenable on condition works immediately. I need a function that runs when the state finish and just before condition oncheck executes for the first time. I don’t want to subscribe to events early.

    I generally run my tasks in sequence and I set transition condition to “check after state finished”.

    #13286
    Gavalakis
    Keymaster

    Hmm. I see. I didn’t know you were using “Check After State Finish”.
    I will look into changing the OnEnable in that case, so that it will be called after the state finished like you describe.
    Will that change work for you?

    Thank you.

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

    #13288
    atmuc
    Participant

    for OnEnable, yes. will OnDisable execute before the first action of the next state? subscribe events will be at OnEnable and unsubscribe events will be at OnDisable.

    #13298
    Gavalakis
    Keymaster

    Yes, OnDisable will execute before next state action.

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

    #13302
    atmuc
    Participant

    Great! I am looking forward to getting the next update.

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