How can I program SendMessage() with a receiver in C#? In JS I can use in one object SendMessage like("nameOfReceiverfunction", true); and in the receiving object: function nameOfReceiverfunction (on: bool) { //do what you need with this message } How do I achieve the same in C#? (I know I can use GetComponent(), but I would like to really use SendMessage. Do I need delegates? .NET event handling? Thanks for your answer.
It looks exactly the same as in js, difference is that the function declaration looks slightly different as you can see below. But the rest is 100% equal and a single sendmessage can trigger a unityscript, C and boo function in the same go on the same GO if it wants to Code (csharp): void nameOfReceiverfunction (bool on) { //do what you need with this message }