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

OnSceneGUI code not working after update

Discussion in 'Scripting' started by barinelg, Mar 4, 2015.

  1. barinelg

    barinelg

    Joined:
    Jun 1, 2010
    Posts:
    95
    We had a map editor tool that used OnSceneGUI. After updating to Unity 5, the screen GUI isn't drawing but the functionality is working. Has this happened to anyone else? Did something change that I overlooked?
     
  2. CastleIsGreat

    CastleIsGreat

    Joined:
    Nov 10, 2014
    Posts:
    176
    Can you be a little more specific on what is occuring when you try to use it? Errors in the scripts etc.? Or is the script running, and just nothing happening?
     
  3. barinelg

    barinelg

    Joined:
    Jun 1, 2010
    Posts:
    95
    There are no errors whatsoever. Basically the visual aspect, which uses the Handles class to draw onto the view, doesn't work. The input, however, does work.
     
    Last edited: Mar 4, 2015
  4. ZyntaxError

    ZyntaxError

    Joined:
    Mar 4, 2015
    Posts:
    1
    Had same problem and found some solution:
    There was Event.current.Use(); at end of OnSceneGUI().
    I think it ate repaint event and poof.
    if( Event.current.type != EventType.repaint ) Event.current.Use(); fixed it

    Using 5.0.0f4 x64
     
    SirGhoul likes this.
  5. barinelg

    barinelg

    Joined:
    Jun 1, 2010
    Posts:
    95
    Thanks, ZyntaxError! I haven't tried that yet, but I know that exists in the code. I'll adjust. :)