Untitled
Anonymous
plain_text
02/23/2026 11:00 PM
1.5 KB
11
Indexable
func _ensure_ui_bound() -> bool:
if dialogue_ui != null:
return true
var root := get_tree().root
# 1) Find UIRoot anywhere in the running tree
var ui := root.find_child("UIRoot", true, false)
if ui != null:
dialogue_ui = ui.get_node_or_null("DialogueUI")
note_ui = ui.get_node_or_null("NoteUI")
fade_rect = ui.get_node_or_null("FadeRect")
item_get_overlay = ui.get_node_or_null("ItemGetOverlay")
# Try to find the Main node by script/class (fallback: by name)
# If your Main node isn't named "Main", this still works for UI access.
if main_ref == null:
main_ref = root.find_child("Main", true, false)
# 2) Last resort: search by control names directly
if dialogue_ui == null:
dialogue_ui = root.find_child("DialogueUI", true, false)
note_ui = root.find_child("NoteUI", true, false)
fade_rect = root.find_child("FadeRect", true, false)
item_get_overlay = root.find_child("ItemGetOverlay", true, false)
if dialogue_ui == null:
push_error("Foxpost: dialogue_ui is null. Could not find UIRoot/DialogueUI anywhere. Check node names: 'UIRoot' and 'DialogueUI'.")
return false
return trueEditor is loading...
Leave a Comment