shaded ingame ui element

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nomys_Tempar
:warning: Old Version Published before Godot 3 was released.

Hi !

I’m working on a game with a lot of ui element in it (buttons, richtextlabel, etc). Some of them are shaded when I come to some phases of the game, and I don’t know why. They aren’t disabled or anything in my scripts…

Why ui elements are shaded ?

Are they shaded from an actual state change, or is there something possibly overlaying them at that stage of the game?

Michael Paul | 2017-11-28 03:00

No ideas.

I have 2 scenes (player 1 and player 2), sharing a richtextlabel and which player scene have its own instances of labels and buttons.

When I’m loading player 1, the richtextlabel is shaded from the beginning, my buttons are ok, when i’m activating a button it write something in the richtextlabel then load the player 2 scene. On the player 2 scene the richtextlabel is shaded and my buttons are shaded too.

There is no reason the richtextlabel be overlayed by anything or being disable, because I still can générating text in it.

Nomys_Tempar | 2017-11-28 08:57

Did you try putting your UI at the bottom of your scene tree rather than child of players? Or on a separate layer? Because otherwise they will be drawn inside the game world (and be affected by any effect or lighting that may occur in there)

Zylann | 2017-11-28 12:35

It’s what I did first, and it works well (I guess…), but I had to switch to multiple scenes to enhance controls over ui elements.

I do not know what you mean by “separate layer”…

Nomys_Tempar | 2017-11-28 12:54

Okay, progress, I have set up some panels in background (parent nodes in the players scenes), it seems that they overlaping with some ui elements. Strangely they don’t overlap with line_edit nodes…

Is there a way to indeed tell who is in front of who ?

Nomys_Tempar | 2017-11-28 16:05

Scenes and nodes are stacked from back to front visually, so the last loaded will be visible over anything loaded earlier (unless the “Behind Parent” box is ticked). You stated that you " have 2 scenes (player 1 and player 2), sharing a richtextlabel"… I’m not sure what you mean by that as scenes are independent of each other. It sounds like you are overlaying buttons from multiple scenes. If that is the case, you need to show & hide through code which ones should show at what point in time. If these are buttons that are always visible and could be shared, they probably should be in a “HUD” scene that lays on top of the rest of the scenes.

Michael Paul | 2017-11-28 16:44

So I will make a HUD scene for my richtextlabel.

the scenes look like :

scene player 1 :

  • instanced scene buttons
  • instanced scene richtextlabel

scene player 2 :

  • instanced scene buttons
  • instanced scene richtextlabel

The richtextlabel as to be shared = HUD scene like you said.

The buttons are different for every players, when i load player 1, buttons are on top and when I load player 2, buttons are shaded.
Regarding your answer it shouldn’t be…

Nomys_Tempar | 2017-11-29 06:55

My answer was to your question “Is there a way to indeed tell who is in front of who ?”, and I was stating the order in which they are layered.There may be other factors that we can’t see without a screenshot, your actual project itself, or a better description.

Michael Paul | 2017-11-29 11:23

Hum… It seems singleton are handle differently than the order you stated. But I don’t understand the logic, I’ll get back when I figure this out…

Nomys_Tempar | 2017-11-29 13:37

So everything is fixed !

I was indeed some instances covering each other, but I manage to clear this only with the distant inspector to see where and when some instances were created.

Also autoload instances were covering everything, so it good to know (didn’t seems obvious to me but I guess it is…).

Thanks everyone !

Nomys_Tempar | 2017-12-07 16:25