Unity GameObjects only in Editor please

Say you have a project with objects you don’t want in your final build. With unity you can go about this is a whole bunch of different ways.
You can add a script that can do a bunch of things like destroy the objects if it’s not running in the editor, or you could just simply disable the object.
Or if you want an unsafe and impractical method you could delete the gameobjects build the player and then undo.

Why go to all that trouble when you can just add the EditorOnly tag this causes Unity to not include these tagged gameobjects in the built player.
Without requiring even a single line of code. Ok, it’s possible you’ve already added a specific tag to your special gameobjects, then you just create an empty gameobject and give it the EditorOnly tag and hang your objects as child objects under it.

EditorOnly

1 thought on “Unity GameObjects only in Editor please”

Leave a Reply