I have an object being instantiated at Start(). How would I make that instantiated prefab visible in the editor? Do I need to take it out of Startup() and put it in an editor script as PrefabUtility.InstantiatePrefab() instead? All I want are things spawned at startup to be visible in the editor. Is there a way to do that?
I’m pretty sure ExecuteInEditMode is what you’re looking for.
The cloning problem you mentioned will be caused by the fact that Start() runs a lot more often in the editor (at least every recompile if memory serves), but the first clone is presumably being saved to the scene (and thus isn’t removed when the scene reloads). What you’ll probably want to do is keep a reference to object when you make it, so you can destroy it when Start() runs again.
However, its possible the reference will be lost when the script recompiles. Serialising/public’ing the field may avoid the problem ([HideInInspector] will hide it in inspector if you want). If not, you’re probably stuck checking the children for a component you know is on the prefab and destroying that game object before re-instantiating (unless you don’t care about updating this prefab each rebuild)
Figured out one solution after a bit more searching. Actually, this seems to result in a collection of cloned objects in the scene.