Event Subscription: Non Static?

Can I subscribe to local, non static events of a component?

So, I have a general component, rotation_mng. It handles the rotation of an object. It will have a manager above it. This manager, maybe a x_script, y_script etc. As such, right now, the only common vaible for the rotation_mng to report back to its prime manager, is GameObject, SendMessage().

I was hoping the x_script, y_script etc, could just subscribe to the local rotation_mng.

Yah? No?

Thanks!

Sure, events don’t need to be static (heck, most events I’ve ever written aren’t static). You just need a reference to the dispatcher (the object raising the event).

Right, so as far as I know, the only common dispatcher I can use is GameObject.

In my case, X_script, Y_Script etc all want to access a local instance of the Rotation_Manager. My issue is the Rotation_Mng can report back to the X_Script, or Y_Script, but only via GameObject.SendMessage()…

Otherwise the rotation_manager would have to hold variables for the X_Script, Y_Script and however many other scripts I might want to use. So the potential for clutter is great.

Thanks

Why not do something like this:

public class RotationManager
{
   public event Action OnSomethingChanged;
}

Then X_script and Y_script can subscribe themselves to RotationManager’s OnSomethingChanged delegate?

Doesn’t need to be static. Unless you want it to be static.

S

Thank You!!!