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

Occlusion Culling for GUI Elements

Discussion in 'UGUI & TextMesh Pro' started by sublime11, Mar 18, 2015.

  1. sublime11

    sublime11

    Joined:
    Mar 1, 2013
    Posts:
    2
    Hi there,

    I have a scroll rect with a large content area and multiple objects in it. I only want to render objects when they are actually visible (either by the camrea or by the scroll rect mask). Anyway i tried occlusion areas and portals but cant get it to work. My occlusion area does not have a "isTargetVolume" property as shown in the Docs. Only is View volume.

    Can anybody tell me if this is even possible for gui elements?

    Thanks in advance
     
  2. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,685
    :D, all you need is MASK

    Add a Mask component and an Image component (doesn't need an image assigned) to the ScrollRect. Then everything outside the ScrollRect will not be drawn.
     
  3. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
  4. sublime11

    sublime11

    Joined:
    Mar 1, 2013
    Posts:
    2
    Nope this doesnt do the trick. I am sorry i have to be more specific. My Problem ist not that the content ist visible (it is not) however it still produces drawcalls even though most elements are not within the angle of the camera.
     
  5. Feaver1968

    Feaver1968

    Joined:
    Nov 16, 2014
    Posts:
    70
    It is late and I should be asleep.... Just a warning in advance about my idea.

    Check the y position of each object in the scrollrect in update or when a scroll occurs. If y exceeds the boundaries of the scrollrect, turn the rendering component (image, text, etc) off.