OnObjectCreate event

I need a way to detect when a new gameObject has been created or added to the hierarchy. The intent is to speed up development time for specific gameObjects that will always need the same configuration or component(s).

I tried EditorWindow.OnHierarchyChange() but it seems expensive in that it fires for EVERYTHING, new objects, deleted objects and values changed on objects, and I can’t find a way to only parse the changed or new gameObject. I have to make a loop that parses every single object in the scene. Imagine this getting ran on all gameObjects every time a single value is changed.

foreach (Transform x in Transform.FindObjectsOfType<Transform>())
        {
            // code to parse every gameObject goes here
        }

Heres an example of a perfect world

EditorWindow.OnHierarchyNewObject() += ParseNewObject(newObject);
ParseNewObject(GameObject theNewObject)
{
    // onetime heavy lifting code goes here and only runs on the new gameObject
}

Why don’t you add OnEnable() method on that object that will be spawned in run-time and write into it whatever you want.