Author Topic: in-game UI  (Read 2831 times)

Abe_ForkTech

  • Guest
in-game UI
« on: January 14, 2013, 02:19:00 AM »
Hi,

First I am sorry I have already asked the same thing in my previous post but unfortunately I didn't get any answers so I thought to ask it in a new post:
http://www.tasharen.com/forum/index.php?topic=2732.0

So, I have a game scene consisting of a Main Camera (Perspective Camera - NON-NGUI Camera) and other objects, which works fine. Now I want to add a 2D NGUI camera so that I could display some in-game UI (I am not sure if its called HUD  :-[ ). In-game UI like start fight button, exit fight button and other text like player score etc while the player is playing.

What do you ppl suggest?

1) Add the 2D NGUI camera in the same scene at a different layer and set the depth so that the main camera is rendered first and then the in-game UI camera?

OR

2) Add a separate scene in the project which contains the in-game UI and add it to the game scene at run time through some script using alternative of "Application.LoadLevel" which doesn't destroy that current level?

OR

3) Is there any other preferred way I should do it?

Thanks,
Abe

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: in-game UI
« Reply #1 on: January 14, 2013, 03:02:15 AM »
1.

Avoid loading scenes if you can avoid it. If you don't need any GUI during gameplay, you can always hide it.

Majicpanda

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
Re: in-game UI
« Reply #2 on: January 14, 2013, 02:01:13 PM »
Is this true? I know lots of devs who use LoadAdditive for their GUI to lay on top of the normal game.  There a reason not to do this?  It makes it a lot easier to create a scene for your GUI and use it on 1 to N levels without using a prefab.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: in-game UI
« Reply #3 on: January 15, 2013, 08:39:26 AM »
It depends on your kind of game, I guess. An angry birds style game with many, many levels and a level hub might want to split it up in some way.

Consider the implications of having the UI in its own scene - you have to load a new scene every time you exit the menu and play, and the same back. Every seconds counts, especially on touch devices. If users are bored, they leave.

You can do a mix of 2 and 1 by having your UI setup in a prefab and load that on start in the scene - that way you can edit it in another "editing scene" that doesn't need to have all the game code in it.