Godot Version
4.7.1
Question
I wonder if there is some easy way how to manage HUD’s.
In level and character itself is HUD to not get overlapping boxes of text.
There is plugin which manage this from localization.
Currently I’m adapting a more aspects from https://forum.godotengine.org/t/rick-o-shea/141433/3 .
Ok what scene is looks like ?
Area3D got collision shape which is entered and text is pulled on screen on enter, and on exit hide.
@onready var shooting_gallery: MapLevel3D = $".."
func _ready() -> void:
body_entered.connect(_on_body_entered)
body_exited.connect(_on_body_exited)
func _on_body_entered(body: Node3D) -> void:
if body is Player:
canvas_layer.show()
shooting_gallery.canvas_active = true
func _on_body_exited(body: Node3D) -> void:
if body is Player:
canvas_layer.hide()
shooting_gallery.canvas_active = false
I thought to make something in those lines to not get overlap of text:
@onready var shooting_gallery: MapLevel3D = $".."
func _process(delta: float) -> void:
if cat_rescued == true:
if shooting_gallery.canvas_active == false:
canvas_layer.show()
if shooting_gallery.canvas_active == true:
canvas_layer.hide()
else:
pass
But then realized there is another issue, when I pause game the player’s hud use simple script
extends CanvasLayer
func _notification(what: int) -> void:
match what:
NOTIFICATION_PAUSED:
hide()
NOTIFICATION_UNPAUSED:
show()
So logical solution would be use it on all CanvasLayers inside Area3D and Teleport, but this open another problem, it ignoring process function.
So before I dedicate to make extension of the CanvasLayer script and move condition there is there some simple solution how to manage those HUDs:
So they won’t overlap, and when I’m in Area3D collision it shows CanvasLayer there, when pause game it disable, and when return it be shown again, but when I’m out of area3d it check whatever I finished task before it’s displayed.
BTW current condition to check whatever open portal is this:
func _on_cat_rescued() -> void:
number_of_cats -= 1
if number_of_cats <= 0:
print("CATS COMPLETE")
cat_rescued = true
collision_shape_3d.disabled = false
gpu_particles_3d.emitting = true
get_node("Portal").show()
Any advice be appreciated.



