How do I render a prefab without any scripts/components running?

We have a number of prefabs that we instantiate as needed, each of which contain several scripts that automatically initialize them, send messages, register in lists, do fun stuff, etc.

However, I would like to render an "empty" copy of the prefab (i.e. just draw it without it doing any arbitrary stuff in the background), and I would like to know the best, safest, most reliable way to do this.

My first thought was to try to pull out all the meshes/renderers/animation components from the prefab, dynamically 'build' another, and use that, but I don't think there is any way to access the internals of the prefab without instantiating it (please correct me if that is wrong).

Assuming that is true, then I would need to instantiate the prefab. Is it possible to Instantiate() the prefab without running any of the code in the scripts, including their Awake() methods?

first of all, you can easily change the components of prefabs before their instantiation. you should have a reference to them in your script. if you have that reference you can just use the GetComponent function and get it's components and do any other thing that you do with a normal gameobject. even you can change the transform but it's not in your scene and it will not render in any position. i don't know much about the implementation because the documentation says nothing about the engine internals. you can disable your scripts easily. let's assume that you have a prefab reference called "o" that is a GameObject. there is a script attached to it called "s", to disable this just right a code like this.


this is a C# code and the method is generic and can not be used on iphone. you should use the method with typeof or as keyword in iphone.

about drawing a mesh you can do different things. 1 if you have unity pro just use the graphics class methods to draw meshes. it's the fastest and most lightweight way to draw a mesh in unity. 2 you can create another prefab with new requirements and don't add script components and other components that you don't need and instantiate that prefab instead of the original one.

Use SetActiveRecursively(false) on the instantiated game object so it won't do any script processing.

The problem is that if you instantiate a prefab right after the Instantiate() call Awake is called before you can do anything else. It's almost like the constructor. If that's not a big problem you can instantiate your prefab anddeactivate or remove the components you don't need / want like mentioned above. There's a nice way to remove or deactivate only the scripts of an GameObject:

MonoBehaviour[] Scripts = GetComponentsInChildren<MonoBehaviour>();
foreach (MonoBehaviour MB in Scripts)


If the Awake would get you in trouble my approach would be to write an editor script that creates those preview-prefabs in the editor. Editorscripts are so powerful, half of my life is running in the Unityeditor. It's almost like you are in "The Matrix" :D