Search Unity

Question Inactive GameObjects

Discussion in 'World Building' started by warrenbrandt, Mar 25, 2023.

  1. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    Hi guys,

    If I have a 3D object like a house. And it is inactive until the player reaches a certain point, does that save memory/resources? Or does an object need to be instantiated and then destroyed again?

    thanks
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,443
    Everything in the Hierarchy is in memory.

    Everything in the Hierarchy will affect how long certain functions like FindObject will take, as those searches have to weed through all objects to find the one(s) you want.

    Everything with an active Renderer component takes rendering time.

    Everything with an active Collider component takes physics time.

    And so on.

    Inactive objects or disabled components take a lot less time but are kept in memory.

    If you have a LOD Group on a house, then only the Renderers at the current LOD will be used on every graphics frame, so you save time. However, the other LODs are still in memory.
     
  3. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    Thanks for all that guy!!!