• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by Statement · Dec 21, 2010 at 12:06 PM · tag

What is EditorOnly tag used for?

Looking at the documentation for tags, I stumbled across the predefined tag "EditorOnly". Does it hold any special attributes such as "MainCamera" does for the main camera? What is the intent of this tag?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hexagonius · Oct 29, 2015 at 04:57 PM 0
Share

We used the tag for background images so we could setup our UI. They exist within the UI hierarchy and are tagged EditorOnly. While profiling iPad Air 2 in Development build, we recognised their graphics being put into RA$$anonymous$$.

Are there requirements to be met like "only root Gameobjects will be removed", or "the gameobject has to be active", or "the gameobject must be available in the scene on build?"

3 Replies

· Add your reply
  • Sort: 
avatar image
9
Best Answer

Answer by Meltdown · Dec 21, 2010 at 02:03 PM

Sometimes you may want to draw some waypoints or markers in the editor, to make it easier to debug your game. for instance if you want a patrolling guard to walk a route, you may want render the route in debug mode as a set of lines, and confirm the guard is walking along it, obviously you don't want these lines appearing in your game, so you can set them as EditorOnly.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Statement · Dec 21, 2010 at 02:29 PM 3
Share

Oh I see! Objects with the tag are removed when building the game. I was only trying it out in the editor and I couldn't see any effects. I just tried it out, things with the tag are removed automatically when building.

avatar image ikriz · Aug 24, 2015 at 12:04 PM 0
Share

One of those little hidden gems

avatar image
2

Answer by eiked · Mar 26, 2019 at 12:50 PM

I've made a test with Unity 2018.2.20f1 and game objects tagged with "EditorOnly" are being removed from compiled scenes. Prefabs remain however untouched and will contain game objects with this tag in the compiled game as well.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hexagonius · Mar 26, 2019 at 06:58 PM 1
Share

the tag only works on root gameobjects

avatar image
0

Answer by Zib Redlektab · Dec 21, 2010 at 01:05 PM

I would assume that the tag is supposed to be used for objects that should never appear in an exported game, like guide objects or the like. However, minimal testing makes it seem like no, it doesn't hold any special attributes. It's up to you to implement its purpose.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Statement · Dec 21, 2010 at 02:40 PM 1
Share

Actually, it turns out that objects tagged with EditorOnly are removed when building the game.

avatar image Ferb · Mar 26, 2015 at 12:06 PM 0
Share

Documentation says these objects are removed when building, but I've not found this to happen in practise, for any platform I've tested. I have to run a script that says:

 foreach (GameObject go in GameObject.FindGameObjectsWithTag("EditorOnly")) Destroy(go);

(Generally foreach should be avoided, but this only runs once at the start of the scene, so simplicity is more important than efficiency here.)

avatar image ikriz · Aug 24, 2015 at 12:06 PM 1
Share

does not require a script to do this, the current 5.2 build removes the gameobjects automatically from your build

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Matching objects using drag and drop 1 Answer

Enabling / Disabling Collider Help 1 Answer

Raycast Tag hit not working 1 Answer

Check if there is a child of object, and if so, get tag? 2 Answers

Disable Box Collider on Tagged Object 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges