Editor Script for attaching components to game object on creation

Hi there, I am looking for this for quite some time now. i have a big level with several game objects. I want a certain scripts to be attached to the object when it is created or a pop up window to be displayed when a new object is created. I have done the window part but it is working with menu item now. What exactly i need is a function like OnCreate or something, that would call this window automatically. or any simple work around is accepted.

Problem is the designer misses out on adding scripts to a lot of game objects, which is wasting a lot of my time…

Don’t blame the designer :stuck_out_tongue:


  • Liberal use of [RequireComponent(typeof(MyAmazingComponent))]
  • Gently and ever so politely encourage designer to test what they create.
  • Provide designer with template prefabs they can duplicate that come prepackaged with the required scripts
  • Slightly less gently remind designer to test what they create
  • Create a script that is somewhere in the scene that is constantly checking (even in Edit mode - [ExecuteInEditMode]) that objects have the required scripts and provides errors as required
  • Don’t just log errors to the console, create a popup that has to be dismissed. Your designer might not be a technical person, don’t assume they read logs
  • Even less gently remind the designer that they MUST test everything they create… otherwise how do they know their design is good? What kind of designer isn’t constantly testing?