Reply To: Events/Signals as global from code?

Slate Forums Support Events/Signals as global from code? Reply To: Events/Signals as global from code?

#2225
Gavalakis
Keymaster

Hello there,

I cant move the post to NC (somewhat different databases), but I will answer your question here, no problem 🙂

So, to send a global event you simply need to use the static method Graph.SendGlobalEvent (same arguments as SendEvent) instead of the instance method found on GraphOwner.

For Signals, it is a bit different. You need to get a reference to the SignalDefinition (the scriptable object) and then call the instance method in it Invoke. Regarding the parameters,
sender -> just a reference to a sender transform; not very important unless expected.
receiver -> null if you are going to invoke signal as global, otherwise the transform that should be awaiting the signal event (has already subscribed).
isGlobal -> true or false as appropriate.
args -> the signal event arguments. Should match the same length and type in order of appearance as the parameters defined in the Signal Definition inspector.

Please let me know if the above works for you 🙂
Thanks!

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