Unity UI and best ways to handle overlay?

so what my question actually is.

in unity i can use multiple scenes and unload and load them however i want. and what i wish to know is that is it reasonable to use Scenes as a Overlay as in GUI? and unload when no longer needed? or is there some prettier ways?

also is when a scene is unloaded does it still use memory or something else?

1 Like

What’s stopping you from just disabling the ui, or am I misunderstanding?

well what i ment is that if u got a rpg like game where u have a UI would it be reasonable to use a scene as a overlay?

Why would you need an entire scene for the UI objects? I’m really confused what you’re trying to do

okay let me try and explain better then

so in Unity we have the ability to have multiple scenes right? i what kinda want to know is that if its viable to use those scenes as a GUI object that acts a layer upon the main scene. GameScene > GUI layer.

You mean an otherwise empty scene with just the GUI in it and then LoadLevel Additive it? You could, or you could just make the UI objects prefabs and effectively do the same thing.

I mean it seems possible but I dont really see why you want to take that route?

I use scenes that are just for certain gui’s… I do it this way so that when editing these scene gui’s I don’t have the rest of the shit in the scene to deal with as unity don’t provide a proper scenetab for editing just canvas gui’s … so these gui canvas only scenes are loaded additively if they aren’t already opened. The benefit is you can load/unload them in the scene hierarchy instead of extra management over whats showing. And overall it works better that way than via prefabs (cus that stuff needs improving aswel), or having those canvas’s in particular scenes only.

So aside from the extra hassle and complication to setting them up this way, it can eventually be useful later on as you do multiple scene level loading etc where you are going to need to have some sort of static instance or gameobject scenes that don’t unload and are kept. Just experiment yourself for me though I’ve found ugui stuff in separate scenes works, just some extra hassles to setup, once that is out the way its fine and preferred.

It’s a reasonable approach. In many cases the same UI needs to be duplicated across many scenes. At the same time is desirable to manage low level elements as prefabs. Short of nested prefabs, your best bet is additive scenes.

Note that you do loose the ability to do inspector references between scenes. So it’s not without its downsides.

2 Likes

yes that is where the hassle comes in with initial setup of doing it this way, still its work around-able with extra code.

Yes it is a doable approach. The game I am currently working on uses this method. It seemed weird at first, but has some advantages, like effectively having nested prefabs(ish). It requires a bit work to handle, but not too complex.

2 Likes

The idea i, as far as I knkow, to use scenes and additive loading to setup UI for every level while only constructing it once. I have not used that, but it sounds like a good approach, most likely superior to prefabs.

However. as far as I know, scenes are not layers.

1 Like

Yep, that’s generally how you do it. It’s how I’m handling pretty much all my in-game UI.

That’s how I handle GUI, too – prefabs.

I’m not seeing how scenes would make anything better… I guess combinations of prefabs (aka nested prefabs…)? I do have some complicated code in a few places which has to manage multiple prefabs… hmm…

On an only vaguely-related note, I’m playing through Wasteland 2 on the Xbone and it’s painfully obvious when it needs to load up a GUI prefab off the USB drive… press A, wait, wait, wait…

okay thanks for the great respons all of you. i dif look into the scene management a little more.

Yes, pretty much because there are no nested prefabs. With a very complex ui layout, trying to stuff the whole thing into a prefab quickly become problematic - you’ll end up with, say, panels, with buttons, where button will be prefabbed, and you’ll want them to keep references to original prefabs (if you just drop the panel itno prefabs, references will be lost). And then there might be more than one such panel.

So, this kind of scenario. I actually think dealing with this via scenes is a better idea than trying to stuff UI into prefabs. At the very least testing may be much easier.

2 Likes

If you’ve got a large team developing a complex game, with lots of contextual UI, then it’s probably better to develop the UI in separate scenes, bundle, then load and cache at runtime.

If you try to make some Hud-only or 2D-only scenes, and some game level scenes, how do you manage Unity constantly harping at you about different lighting settings? It seems silly for Unity to complain about different Realtime GI backends or Lightmap resolutions when those things are disabled and/or irrelevant for a Hud scene.

You don’t. Well, until the debug level will be someday introduced. Here’s my rambling post about it:
https://discussions.unity.com/t/708056

You can as well bump it.
I’m actually using multi-scene setup for multiple purposes, UI is one of them. Nobody seems to care from UT, so yeah.

Another option - completely ignore Unity warnings, and write your own logger. Intercept those pesky warnings and remove them, then - output to the console.

Just finished Ludum Dare, where I did just this, effectively replacing most prefabs with scenes.
Working with it like it was layers (multiple UI, maps, additional map items, more map items, player etc etc)
(Game in question, if you are wondering: https://ldjam.com/events/ludum-dare/42/dementia)

I am a huge fan of doing this now, there is just so many pro’s with it, a lot more effective workflow especially when multiple people are working on the “same” scene.

I’m wondering just how many scenes you can get away with, working like this, if it doesn’t have any significant drawbacks (save that unity, and 3rd party, wasn’t design to work like this from the beginning), I would expect a lot more people to work like this in the future.

But then again, I don’t promote myself as a programmer, and my view comes from more an artistic standpoint and workflow, so I wouldn’t know how much impact it would have system wise.

1 Like