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. Dismiss Notice

Unity3D GUI acting strange

Discussion in 'Scripting' started by StickyKeyStudios, Dec 27, 2014.

  1. StickyKeyStudios

    StickyKeyStudios

    Joined:
    Jun 23, 2014
    Posts:
    33
    Hello,

    I know the built in Unity GUI system is awful and the drawcall is very intensive, but I can't pay for any of the other 3rd party GUI systems.

    My problem is that when I change scenes, the GUI from the previous scene is still there. I've tried various ways to stop this, does anyone know a fix for this?
     
  2. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    If the legacy GUI system is causing you performance issues, try updating to 4.6 and using the new GUI system.

    If you have left over clutter from a previous scene, then the OnGUI function being used to draw those things is on a script that's still running.
     
  3. StickyKeyStudios

    StickyKeyStudios

    Joined:
    Jun 23, 2014
    Posts:
    33
    I updated to 4.6 yesterday, is the new GUI system controlled with different code? Any links to the documentation of the new system?
     
  4. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    The new system works quite differently. You've got the possibility to arrange your UI through the editor as everything's based on gameObjects with a RectTransform. Not only that, you can create animated UIs, use it in order to create in-world-UI elements etc. For a quick overview, visit Unity's YT channel and check the introduction video.
    Besides that, there're some downloadable examples in the new Unity UI section as well as tutorials on various video portals. All in all it's more user friendly, especially for the artists, but you can also code it pretty much from scratch if you need more control. Short: it's worth it.
     
  5. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    I've run into scaling issues with the new gui system, but only because it falls short of the perfection of the OnGUI system. For efficiency though, the new ui system is like sprites / planes that contain gui elements so you don't have the performance issues of OnGUI stuff. I use both right now. I use OnGUI to generate screen elements where position & scaling matters, then I use the new GUI to create things based on the world. Like little damage pop off numbers, you can position those over things in the world. It's also great for having speech bubbles pop up over a 3D object.