- Home /
How do I mimic dragging and dropping a FBX to the hierarchy window with an editor script? C#
Answer by eatsleepindie · Nov 21, 2012 at 09:58 AM
If I'm understanding the question correctly, you want to use this :
Thanks guys I had been using instantiate but since the new game object's name in the hierarchy window was not colored blue I thought it was loosing it's connection to the FBX but after more testing I now realize it does not. Updates to the FBX ripple through to the new instantiated object. Thanks :)
Answer by Bunny83 · Nov 23, 2012 at 01:00 AM
Well emorobot is not entirely right ;) Instantiate will clone the object, but it's no longer connected to the orginal prefab. Of course since the clone use the same assets, like a mesh for example, those assets will be updated since they are just references.
To truly Instantiate a prefab you have to use PrefabUtility.InstantiatePrefab.
Keep in mind that this function is an editor function, so don't use it in a runtime script. Prefabs are an editor-only feature at the moment. At runtime prefabs are just normal objects which can be cloned / Instantiated. The only difference is that prefab-objects are not in the scene yet.
Your answer
![](https://koobas.hobune.stream/wayback/20220613084242im_/https://answers.unity.com/themes/thub/images/avi.jpg)