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

Question Do disabled components get built?

Discussion in 'Prefabs' started by KarlKarl2000, Feb 13, 2023.

  1. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    592
    Hello all

    I've been making my game with probuilder, in order to see them in the editor I've used this mesh renderer.

    If the mesh renderer is disabled, will Unity build that into the final game?

    Should I remove this mesh renderer from the prefab? It'll basically affect every level in the game.

    Thanks for the help
    upload_2023-2-13_11-6-50.png
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,860
    Disabled gets built. Hidden gets built. Inactive gets built. Everything referenced in the scene gets built if it was a scene listed in the build settings. Disabled and Inactive things might be enabled or activated by code, and Unity cannot analyze all your code to decide if that's impossible. Hidden is irrelevant to built games because there's no editor.
     
  3. ManuelRauber

    ManuelRauber

    Joined:
    Apr 3, 2015
    Posts:
    114
    Only GameObjects tagged as "EditorOnly" wont get built. So maybe thats something for you.