Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Exclude GameObject from Subscene Baking?

Discussion in 'Entity Component System' started by Thygrrr, Nov 13, 2022.

  1. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    699
    When I create an Object in a Subscene, such as a Cube for example, it gets baked into an Entity without any doing on my part.

    I do not want this for my content generation tools (e.g. helper grids, prefab spawners, hierarchy folders, etc.)

    The ConvertToEntity (Stop) component is deprecated.

    What's the right way to exclude a game object from baking now?
     
  2. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    699
    Some digging pointed me to:
    Code (CSharp):
    1. Unity.Entities.Hybrid.Baking.BakingOnlyEntityAuthoring
    ... is this correct? The Comment in the File is a little misleading.
    Code (CSharp):
    1. /// <summary>
    2. /// Add a BakingOnlyEntity authoring component to your game object to mark it as Bake Only. It and all children will be
    3. /// stripped out before they appear in the live game world. Its additional entities and its children additional entities
    4. /// are exempt from this and will appear in the live game world.
    5. /// </summary>
    I figure I'd have rather called it "DontBake" or "BakeIgnore", literally what I want to happen to the GameObject is completely ignored by the baking process.

    Alternatively, giving some uses to vestigial builtin tags such as EditoryOnly could be a good idea here.
     
    toomasio, bb8_1, Selmar and 2 others like this.
  3. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    988
    Yes it is correct.
    That's what I use in my tutorial to define the path to follow with empty game object and not have them polite my subscene at runtime.
     
    Last edited: Nov 15, 2022
    toomasio and bb8_1 like this.
  4. Selmar

    Selmar

    Joined:
    Sep 13, 2011
    Posts:
    57
    I was also misled by this, I thought the script would remove the source gameobject after baking (initially, also, I did not put my gameobject in a subscene, and I thought a baker was mandatory, so this made some sense to me).
     
    bb8_1 likes this.