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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Find always culled GameObjects?

Discussion in 'General Graphics' started by EncounterStudios, May 28, 2015.

  1. EncounterStudios

    EncounterStudios

    Joined:
    May 1, 2015
    Posts:
    7
    I'm at the stage were I try to optimize my scenes as best as I can.. And I'm just finished with the OC and something came to my mind, I couldn't find any in the Asset Store so I'll give it my best shot here.

    Is there anyway to analyze the scene while the game is beeing played and find out what objects never beeing seen by the camera? These objects are useless and can be deleted from the scene, giving it a little more optimization..
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
  3. EncounterStudios

    EncounterStudios

    Joined:
    May 1, 2015
    Posts:
    7
    I don't think you understood what I meant... Unity doesn't delete the gameobjects from the scene by default. I want something to analyze what objects are never seen by the camera and erase them completely from the scene
     
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    My apologies. If they are never seen in the scene - why are they in the scene to begin with?
    Are scenes being randomly populated with filler assets?

    Maybe if the culling information can be recorded that is a way to learn what isn't being rendered in the scene, but they will still have to be removed manually - I think.
     
    ArachnidAnimal likes this.
  5. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    if the objects arent seen by the camera due to the OC, then they wont be rendered. So there is not much to optimize by deleting them. But, A renderer has an isVisibile variable to check:
    Renderer.isVisible
    http://docs.unity3d.com/ScriptReference/Renderer-isVisible.html
    However, this is not reliable if the object is required to cast shadows, because even if an object isnt "seen" by the camera at all, doesnt mean that it is never rendered. It may still be rendered for bounce lighting or shadowning purposes.
    Personally, i would not worrry about doing what you are trying to do, because you could end up "breaking" something in your game, and it wouldnt be worth the effort to do this.
     
    Last edited: May 29, 2015
    theANMATOR2b likes this.