// GateText.cs // Zweck: Liefert Frage/Label-Text für ein Gate (Direktfeld, worldLabel oder Fallback TMP-Child). using TMPro; using UnityEngine; public class GateText : MonoBehaviour { [TextArea] public string questionText; // expliziter Text [Header("Optional floating label above gate")] public TMP_Text worldLabel; // Label im Welt-Raum public string GetQuestionText() { if (!string.IsNullOrWhiteSpace(questionText)) return questionText; if (worldLabel != null && !string.IsNullOrWhiteSpace(worldLabel.text)) return worldLabel.text; var tmp = GetComponentInChildren(); if (tmp != null && !string.IsNullOrWhiteSpace(tmp.text)) return tmp.text; return ""; } public void SetQuestionText(string text) { questionText = text; if (worldLabel) worldLabel.text = text; } }