using UnityEngine; /// /// Detailed diagnostic script to check what components are actually on GameObjects /// public class SettlementGameObjectDiagnostic : MonoBehaviour { [ContextMenu("Diagnose Settlement GameObjects")] public void DiagnoseGameObjects() { Debug.Log("=== SETTLEMENT GAMEOBJECT DIAGNOSTIC ==="); // Find all GameObjects with settlement-related names var allObjects = FindObjectsOfType(); foreach (var obj in allObjects) { if (obj.name.Contains("Settlement") || obj.name.Contains("settlement")) { Debug.Log($"\n🎯 GameObject: '{obj.name}'"); Debug.Log($" Active: {obj.activeInHierarchy}"); Debug.Log($" Tag: {obj.tag}"); // List all components var components = obj.GetComponents(); Debug.Log($" Components ({components.Length}):"); foreach (var comp in components) { if (comp != null) { Debug.Log($" - {comp.GetType().Name}"); } } } } Debug.Log("\n=== SPECIFIC COMPONENT SEARCH ==="); // Search for specific components var settlementManager = FindFirstObjectByType(); var settlementUI = FindFirstObjectByType(); var settlementBridge = FindFirstObjectByType(); Debug.Log($"SettlementInteractionManager found: {settlementManager != null}"); if (settlementManager != null) { Debug.Log($" On GameObject: '{settlementManager.gameObject.name}'"); } Debug.Log($"SettlementInteractionUI found: {settlementUI != null}"); if (settlementUI != null) { Debug.Log($" On GameObject: '{settlementUI.gameObject.name}'"); } Debug.Log($"SettlementUIBridge found: {settlementBridge != null}"); if (settlementBridge != null) { Debug.Log($" On GameObject: '{settlementBridge.gameObject.name}'"); Debug.Log($" Settlement UI Reference: {settlementBridge.settlementUI != null}"); } Debug.Log("\n=== UI DOCUMENT SEARCH ==="); // Check for UIDocument components var uiDocuments = FindObjectsOfType(); Debug.Log($"Found {uiDocuments.Length} UIDocument components:"); foreach (var uiDoc in uiDocuments) { Debug.Log($" UIDocument on '{uiDoc.gameObject.name}'"); Debug.Log($" Asset: {(uiDoc.visualTreeAsset != null ? uiDoc.visualTreeAsset.name : "NULL")}"); } } }