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

EditorWindow Cliprect available?

Discussion in 'Immediate Mode GUI (IMGUI)' started by Kamilche_, May 20, 2016.

  1. Kamilche_

    Kamilche_

    Joined:
    Jan 11, 2015
    Posts:
    75
    Hi there, I have an EditorWindow that scrolls due to the large number of repeating controls in it. The more controls I add, the more sluggish it gets.

    Digging into it further, it appears that every control gets an OnGUI executed, regardless of whether the control is visible on screen, or not.

    I would like to draw the control only if it would be visible onscreen. So I made a new cliprect of rect(0, 0, screen.width, screen.height) and compared against that, but got erroneous results due to not taking the scroll position into account.

    Does anyone know how to get the current scrollposition of an EditorWindow? Note that I don't use BeginScrollView/EndScrollView - I need the raw scrollposition of the EditorWindow itself.