|Topic was automatically imported from the old Question2Answer platform.
I am trying to achieve the effect where a Light2D node will illuminate other objects but ignore the UI/Text on screen. However I am finding that no matter what combination of item cull masks and light masks I use, the Light2D node is always impacting UI/Text elements.
Currently I have a scene that displays floating text on screen when the player does a certain action, with the following structure (Node2D → Label).
I also have a Light2D node on the player scene (KinematicBody2D → Light2D).
I left the Light2D node’s light masks and cull masks to layer #1, and then set the canvasitem layer mask of the FloatingText scene’s Node2D and Label to #10, expecting the Light2D to ignore it. However this results in the Light2D node affecting the text, against my expectation. I also tried assigning an unlit CanvasItem shader to the Node2D and/or Label however that had no impact.
I tried again and gave the floating text scene its own canvas layer however the player’s Light2D node was still affecting it.
I tried again again but with the Light2D on layer 2 because I read somewhere else that there may or may not be something special about layer #1 for Light2D, but the same behaviour was observed.
So, I am wondering if there is a setting somewhere I’m overlooking, or if there is a better way to go about this. I am curious as to why this is not working as I expected it to. I think there is a work-around solution involving setting LightOccluder2D’s around all of the UI/Text elements but that will not work in this situation because then the text will obstruct light.
Thanks in advance for any help!
PS a similar question was asked before https://forum.godotengine.org/105450/light2d-working-excluded-items-affected-light2d-different?show=105450#q105450
however the OP was able to solve their issue by re-instancing their player scene, but that did not work in this situation for me