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

How would you make UI in 4.6?

Discussion in 'Immediate Mode GUI (IMGUI)' started by Wrymnn, Sep 27, 2014.

  1. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    352
    Hello,

    I haven`t found this answer so far. What I am looking for is how to make UI system in the game, but not simple static menu when you start a game, but when player is actually playing, have tech tree, inventory etc.

    The problem is how to display that?

    My game is 2D top down game. Camera is following player.

    - Where would I put those 4.6 UI elements? I don`t wanna put it just in the middle of the scene where player is with NPC`s and other objects.

    - Also I heard the second UI camera is used, though where would that camera be? In higher Z position?

    -Isn`t it possible to make UI objects apart from scene so it does`t mess with my game object or that it won`t happen that the player encounters UI button floating around instead of asteroid....

    SO yeah, I have been trying to find some tutorials but none of them mentioned how to do this stuff aprt from static menus and simple menu buttons which I know how to do.
    If you know about some king of this tutorial please share, but I haven`t found any.

    Thanks :D
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    You just put them in the scene; they don't "mess with" other objects. There's no second camera used.

    --Eric
     
  3. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    352
    So I just put all the 1000 buttons somewhere next to my planet? It`s kinda strange, even if player won`t see them floating around, in Editor it kinda looks messed up. :DD
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    You can turn off the UI layer if you don't want to see it.

    --Eric
     
  5. Wrymnn

    Wrymnn

    Joined:
    Sep 24, 2014
    Posts:
    352
    Heh okay thanks I will try that :)

    Also sorry for too many questions, but how would loading new scene work? How to move all the UI elements into other scene when I load another map? then another etc.

    Then ofc when I wanna upgrade my UI, add new button, how clicking works or something, how would I apply it to UI for all the scenes?

    Sorry I came from another engine there was everything in one script and I was just drawing sprite on screen without having actual UI objects. So one UI script for entire game.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    You can use DontDestroyOnLoad with the canvas, so it's not destroyed when loading a new scene. Or you could make it into a prefab.

    --Eric