Capture all the UnityEvent's per frame (update)

Forums 💬 NodeCanvas ⚙️ Support Capture all the UnityEvent's per frame (update)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16942
    centaurianmudpig
    Participant

      Hello, hope you had a good Christmas vacation.

      I’ve include an exemplar project to better show what I have with NodeCanvas and what I actually desire (achieved via code only). To recap I am using Unity Events and basically want to capture all the events fired, but I’m only capturing the last event fired in a frame (update)?

      IntEvent (NodeCanvas) invokes 10 and 5 per frame. But only logs the 5 in every frame.
      AnotherIntEvent (Code) invokes 0 and 1 per frame. It logs both the 0 and 1 in every frame (Desired result).

      Exemplar output:

      Desired output:

      #16945
      centaurianmudpig
      Participant

        Here’s the link as the RAR attachment was rejected for security reasons: https://www.dropbox.com/s/fuyxjob11iaokvx/Unity%20Event%20BT.rar?dl=0

        #16944
        Gavalakis
        Keymaster

          Hello,

          I am really sorry for such a late reply! :-/
          Also thank you for providing an example project that helps me understand what you mean.

          Unfortuantely, what you want to achieve, is not really possible in the context of Behaviour Trees. The reason behind this, is simply because a tree is only updated once per frame, meaning that a tree traversal, can at most happen once per frame.
          What is happening here, is that the condition task (IntEvent) is checked, and as soon as it is raised, execution passes on the the action task (Log). As soon as the action task is also finished (within same frame in this case), the tree traversal is done and the next tree traversal will only happen on the next frame. As such, no matter how many times the event is raised within that one frame, it is only really checked once.

          It is undefortunately something that is not really possible to transfer from code and within the context of behaviour trees to work in the same way.

          Please let me know if the explanation/reason why makes sense, or if you want to elaborate further.

          Thank you and once again sorry for the late reply!

          #16943
          centaurianmudpig
          Participant

            Thank you for the reply.

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