Get if any component in gameObject has changed


I’m working on a managing component.
This component need to be informed if any component in the gameObject has been changed or a component has been added or deleted.

Is there a way to determine this, without using Update() and checking every frame?
Is there an event or a something similar which I could use that informs my component of such a change?

I would prefer a solution that works in the editor as well as in a runtime.
If this is not possible, then I would need a solution that at least works in the editor.


  1. I am not familiar with any Unity API for getting informed (e.g: event based) when adding/removing components from a game object.
  2. What do you mean by “informed if any component has been changed” ? what would you consider as a change?
  3. For components added or removed, you can “simulate” this by wrapping Unity’s API with a new wrapper API of your own that will expose an event in case of a Component added or removed. This can look similar to this (just an example):

public class ComponentExtensions

    public event Action<GameObject> ComponentAdded;
    public event Action<GameObject> ComponentRemoved;
    public T AddComponent<T>(GameObject go) where T: Component
        T result = go.AddComponent<T>();
        // Raise event

All your code should use this API for adding/removing components from game objects.
One downside to this technique though is that this is not possible for external code (since it won’t call your wrapper API).