I’m trying to replace a certain prefab in the scene view with another prefab via an editor script. this works fine but all instantiated prefabs are displayed as ‘normal’ game objects. Is there any way to change that behaviour?
Some wiser than myself should verify this, but I don’t think that a prefab is an actual code object- i.e. Once instantiated, all vestiges of the prefab are gone. You might be able to achieve what you want by doing the following:
-attaching all your desired GameObjects to a parent GameObject
-turn that parent GameObject into a prefab
-do the same for the object you wish to replace
-in code do something like:
GameObject myGameObject = Instantiate( firstPrefab);
//later
myGameObject.Destroy();
myGameObject = Instantiate( secondPrefab );
If the second prefab needs to know anything about the state of the first (position, orientation, hit points, whatever) you might need an intermediary structure to keep track of the data.
Anyway, I hope this is somehow helpful.
Cheers!