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?
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?
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.