Message Events via script
Posted: Wed Jan 08, 2025 9:54 am
Hi Tony,
Happy Wednesday! And happy 2025! I hope you are very well.
I have tried for a few months to figure this one myself, but no luck. I am trying to subscribe via script to the message system.
For example, I have a Quest Control component in a gameObject, and I'm using this:
questControl.SendToMessageSystem("Building:Selected");
But I cannot figure out how to receive this message. I'm trying to use Message Events, and I have looked at OnMessage, but I cannot understand how to use the MessageArgs via script. --> messageEvents.OnMessage(???);
Is there a way to do this via script? So far, I have used the Message Event component and just do everything via inspector, but the list of Messages to Listen for is quite long and I need to reduce it.
Thanks in advance!
Cheers
Nico
Happy Wednesday! And happy 2025! I hope you are very well.
I have tried for a few months to figure this one myself, but no luck. I am trying to subscribe via script to the message system.
For example, I have a Quest Control component in a gameObject, and I'm using this:
questControl.SendToMessageSystem("Building:Selected");
But I cannot figure out how to receive this message. I'm trying to use Message Events, and I have looked at OnMessage, but I cannot understand how to use the MessageArgs via script. --> messageEvents.OnMessage(???);
Is there a way to do this via script? So far, I have used the Message Event component and just do everything via inspector, but the list of Messages to Listen for is quite long and I need to reduce it.
Thanks in advance!
Cheers
Nico