- Home /
Question by
Jde · Oct 01, 2012 at 01:16 PM ·
editorinstantiateprefab
PrefabUtility.InstantiatePrefab not working with PrefabType.ModelPrefabInstance?
I have a PrefabType.ModelPrefabInstance in my scene which I have lightmapped and on which I have changed some parameters. What I now want to do is duplicate this and retain all it's parameters.
If I hit Ctrl+d I get exactly what I want; a duplicated version of the original with all connections to the model prefab retained and all parameters intact.
If I try to do this via an editor script using Object.Instantiate it breaks the connection to the prefab.
If I try to do this via an editor script using PrefabUtility.InstantiatePrefab I get an InvalidCastException.
Is what I want to do possible with an editor script?
Thanks
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613081724im_/https://answers.unity.com/themes/thub/images/avi.jpg)