| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using UnityEngine;
- /// <summary>
- /// Detailed diagnostic script to check what components are actually on GameObjects
- /// </summary>
- 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<GameObject>();
- 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<Component>();
- 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<SettlementInteractionManager>();
- var settlementUI = FindFirstObjectByType<SettlementInteractionUI>();
- var settlementBridge = FindFirstObjectByType<SettlementUIBridge>();
- 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<UnityEngine.UIElements.UIDocument>();
- 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")}");
- }
- }
- }
|