Need Help with a Custom Task sending Events to Multiple Objects

Forums 💬 NodeCanvas ⚙️ Support Need Help with a Custom Task sending Events to Multiple Objects

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #18450
    chocolacode
    Participant

      Hi Gavalakis,

      I am trying to create a Task in NodeCanvas which has an input List of GameObjects and needs to send an Event to each one of those GameObjects. I can not use SendGlobalEvent because I have more than 50 GameObjects that use the same FlowSript Asset.

      I am doing a ForEach to the list and want to send an event to each of those GameObjects.
      I am stuck with that, I am getting errors that the “agent” is a read only

      can you suggest what the best use of the API to accomplish this?

      thanks in advance!

      #18456
      Gavalakis
      Keymaster

        Hey,

        Sure. Here is the Task 🙂

        SendEventToObjects.cs

        I will include this task in the next release too, so feel free to place it under the “NodeCanvas/Tasks/Action/Utility” folder 🙂

        Let me know if that is what you were after.
        Cheers!

        #18455
        chocolacode
        Participant

          Hey,

          It works Great!! Thanks a lot for that!!

          just one thing… the regular SendEvent.cs task logs in the console when an event is sent and received, see attached screen. That is really useful

          however this new Task does not.

          Is it possible that you can add that log functionality?

          Thanks again!

          #18454
          Gavalakis
          Keymaster

            Hey,

            You are welcome.

            Events are logged with this task as well, but only as long as the gameobjects in the list do indeed have a GraphOwner component attached and as such the even is indeed send in the end, since for gameobjects without the GraphOwner attached in the list, the even is not send.

            Can you please confirm that?

            Thanks
            🙂

            #18453
            chocolacode
            Participant

              Hi,

              actually I just confirmed that the event is not sent, thats why is not logged

              my scenarios is: FSM Nodecanvas sending events to Multiple Objects with FlowScripts,

              thanks in advance!

              #18452
              Gavalakis
              Keymaster

                Hey,

                I just rechecked this and can confirm that it works here :/
                I’ve also checked like you said, an FSM sending and event to multiple FlowScriptControllers.
                Hmm.. Are the FlowScriptControllers enabled when the event is send? That is, is the “OnEnable” option set to “Enable Behaviour” in the FlowScriptController inspector and the gameobject active as well?

                Can you share a bit more information on your FSM setup please?
                Or better yet, if you can send me a small project reproducing this, that would be great of course!

                Thanks in advance.

                #18451
                chocolacode
                Participant

                  Hey,

                  sorry I was using one other variable with similar name and got confused,

                  This works perfect!!

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