Hide object when changing instantiation

I have a script which allows me to instantiate different objects with a “ghost object”, which is the same object that’s being instantiated, so I can rotate it real-time. Now, when I change between the objects the ghost object changes as well, which is good. Although now I have a problem. The ghost object is placing on the terrain when I instantiate, which seems logical. Is there any way I can “hide” the ghost object and when I click on a button I can show it again? What’s the best way to do this?

Thanks

What is a ghost object? Do you mean a prefab? Sharing your code might help.

If you want to instantiate an object and make it hidden from view, use this code:

GameObject newObj = (GameObject)GameObject.Instantiate(prefab);
newObj.renderer.enabled = false;

The second command will turn the renderer off, hence the new object will not be visible. Turn it back on if you want to make it visible again.