Unity GameObjects only in Editor please


iKriz Avatar

Posted

in

, ,

by

last modified on

Tags:


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

Comments

One response to “Unity GameObjects only in Editor please”

  1. Vineet Kumar Avatar

    hahaha…worked for so long on Unity and i didn’t knew this .. Thanks bro

Leave a Reply

Your email address will not be published. Required fields are marked *