// SafetyTrigger.cs using UnityEngine; public class SafetyTrigger : MonoBehaviour { [SerializeField] private string playerTag = "Player"; public GateSpawner spawner; private void OnTriggerEnter(Collider other) { // Robust root detection (matches GateAnswer approach) Transform root = other.attachedRigidbody ? other.attachedRigidbody.transform : other.transform.root; if (!root.CompareTag(playerTag)) return; // Uncomment while debugging: // Debug.Log($"[SafetyTrigger] Hit by {root.name} (tag {root.tag})"); spawner?.HandleGateAnswered(false); } }