Possible To Execute A Script From Non-Monobehavior?

Forums 💬 NodeCanvas ⚙️ Support Possible To Execute A Script From Non-Monobehavior?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17174
    meatloaf
    Participant

      Currently i’m using the ExecuteFunction task on a variety of scripts. One problem that we have ran into is that it’s only possible to call a function from a MonoBehavior class, or a static method from a non Monobehavior class.

      It would be really great if there was the possibility to call a function from a non Monobehavior class as well.

      Is this currently possible and maybe i’m missing something?

      Thanks in advance!

      #17176
      Gavalakis
      Keymaster

        Hey,

        Unfortunately right now, the ExecuteFunction only works with UnityEngine.Object instances (or no instance for static of course). This is because ActionTasks themselves which ExecuteFunction derives from, only work with UnityEngine.Object instances as well. The fact that Tasks work with UnityEngine.Object instead of say System.Object, was a critical decision that was made back when the framework was developed and it is not something that can easily be changed due to serialization right now.
        There can of course be workarounds this that I could investigate into, but just to clarify:
        Do you mean ExecuteFunction to work with instances stored in blackboard variables more specifically?

        Let me know.
        Thanks 🙂

        #17175
        meatloaf
        Participant

          Hey thanks for the reply. Actually this question and this question here were asked in order to try and get NodeCanvas working a bit more seamlessly with game state code. The way we ended up solving our issue can be found here.

          Essentially what we did was create a new node that allows for both code and actions. This allowed us to be a bit more flexible when it came to prototyping / expediting state code (using actions) as well as executing non monobehavior code in a state.

          Would love to hear your thoughts on this.

          Thanks in advance!

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