Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

EditorOnly tag?

Discussion in 'Scripting' started by Nanako, Nov 13, 2014.

  1. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Hi all. i'd like to ask about the editorOnly tag. It seems that objects tagged with it won't appear in a final build/export version of a game, however they DO appear in play mode, which isn't what i'd like.

    I'm wondering if there's any way to make that not happen? I have a massive object which i'd like to only show in the scene window, and not in the game window. Is that possible at all without a runtime script?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    Put it on a layer that's displayed in the editor but not by the game view camera.

    --Eric
     
  3. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Will that only cover displaying/rendering, or will it completely disable the object? the latter is what i'd like to do, (though i guess there aren't many use cases for a difference)
     
  4. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    oh and out of curiosity, is there a way to do the reverse? Have something shown in game/build but NOT in the scene view?
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    Using layers will only affect rendering.

    --Eric
     
  6. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,377
    So all my scenes get various GameObjects slapped in them to handle the startup of the scene. One of them is a 'DebugInitialize' script that allows me to start any scene up and have all the general stuff that needs to be wired up at start (would be in my startup scene for release) so that I can actually play the scene.

    In such a script you can loop over all gameobjects and delete those that are tagged as EditorOnly.