Same OnEnable()/OnDisable() on multiple scripts? Calling same method name from one script

You could do it by an interface that more than one class expresses, such as an IResettable

I don’t think Unity’s find stuff works with interfaces (yet?) but the Get Component does, so you could iterate root GameObjects and ask each one GetComponentsInChildren() with your interface to find ALL that have IResettable.

More reading:

Using Interfaces in Unity3D:

Check Youtube for other tutorials about interfaces and working in Unity3D. It’s a pretty powerful combination.

1 Like