Need help with prefabs

Ok, so i’m using Javascript and would like to replace the player’s prefab with a different one, how would i go about doing this? i am doing it via buttons.

as in he’s using one ship/car/thing and you have a button to change it to a different ship/car/thing?

It may be done only in Editor mode via this function

Edit:

Actually i just looked it over again, let me explain a bit more indepth, i have a ship object that is a prefab with lights, weapons, engines etc… i want to be able to click my button, delete the current prefab and load in the new/different prefab.

Also if anyone can point out a way to access the Transform only of the mouse-orbit script that would be excellent, i would like the mouse-orbit script to always orbit the new prefab.

I’ve been trying to figure out something similar, best way I’ve found so far is using a parent object which has any components which don’t change in it (for example the transform position and the scripts handling the button clicking), then the prefab(s) which do change are instantiated and made a child of the parent. Click the gui button and the existing child is destroyed and a new object based on the different prefab is instantiated and made a child of the parent again.

However this does not sound like it will work with many different prefabs which all have different scripts and such, not to mention i think scripting this would be easier.