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.

How to get OnPostRender called after OnGUI.? URGENT

Discussion in 'Immediate Mode GUI (IMGUI)' started by ahmedali, Feb 16, 2012.

  1. ahmedali

    ahmedali

    Joined:
    Feb 9, 2012
    Posts:
    5
    In my code Im implementing a custom control using GL in OnPostRender but it is appearing behind the GUI controls rendered in OnGUI, is there a way to change order?
     
  2. zloty

    zloty

    Joined:
    Mar 11, 2010
    Posts:
    37
    Menion-Leah likes this.
  3. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    210
    This is a very, VERY bad advice. Downright terrible. Starting couroutine every OnPostrender callback is insane waste of resources GC pressure and just calls for stutterfest.

    Make a method with your GL draw logic and call it from OnGUI under event Repaint (and Repaint only) after whatever elements you need to draw it. Again, make sure you limit this call to be once per OnGUI because OnGUI called multipl;e times per frame. Repaint event called once per frame.