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

Order of OnGUI calls

Discussion in 'Immediate Mode GUI (IMGUI)' started by jashan, Jan 8, 2008.

  1. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I'm not sure if I missed that on the forums or in the documentation, but what about the order of OnGUI calls in different transforms? Is there any well-defined order, or a way to control this?

    The reason I'm asking is that I have on Transform with some general GUI stuff (basically similar to the startup screen in Lerpz), which includes a backdrop image. Now, obviously, when OnGUI from another transform (in my case a little chat control) is called before that, it will be hidden by the backdrop image.

    I might do a workaround by simply changing the name of OnGUI() in the latter one, and calling it from the earlier one (that way, I gain full control). Are there any other solutions?

    Jashan
     
  2. StarQuail

    StarQuail

    Joined:
    Oct 9, 2007
    Posts:
    17
    I might be misunderstanding your question, but I think that's what GUI.depth is for. Just set it to a lower value in your chat control script's OnGUI handler than you do in your background image script's OnGUI. See this post for more information.
     
  3. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hi Daniel,

    thanks! That was what I was looking for!

    Jashan