데이터파이프라인 타워 부분 개선
This commit is contained in:
80
Assets/Scripts/Editor/TowerPopulator.cs
Normal file
80
Assets/Scripts/Editor/TowerPopulator.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Northbound;
|
||||
using Northbound.Data;
|
||||
|
||||
namespace Northbound.Editor
|
||||
{
|
||||
public class TowerPopulator
|
||||
{
|
||||
private const string TOWER_PREFAB_PATH = "Assets/Prefabs/Tower";
|
||||
private const string TOWER_DATA_PATH = "Assets/Data/ScriptableObjects";
|
||||
|
||||
[MenuItem("Northbound/Diagnose Tower System")]
|
||||
public static void DiagnoseTowerSystem()
|
||||
{
|
||||
Debug.Log($"<color=cyan>========================================</color>");
|
||||
Debug.Log($"<color=cyan>[TowerPopulator] DIAGNOSING TOWER SYSTEM</color>");
|
||||
Debug.Log($"<color=cyan>========================================</color>");
|
||||
|
||||
string[] prefabGuids = AssetDatabase.FindAssets("t:Tower", new[] { TOWER_PREFAB_PATH });
|
||||
Debug.Log($"<color=cyan>Tower Prefabs in Assets/Prefabs/Tower/:</color>");
|
||||
if (prefabGuids.Length == 0)
|
||||
{
|
||||
Debug.Log($"<color=red>✗ No tower prefabs found!</color>");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string guid in prefabGuids)
|
||||
{
|
||||
string assetPath = AssetDatabase.GUIDToAssetPath(guid);
|
||||
GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
|
||||
TowerDataComponent tower = prefab?.GetComponent<TowerDataComponent>();
|
||||
string towerStatus = tower != null && tower.towerData != null ? "<color=green>✓</color>" : "<color=red>✗</color>";
|
||||
string towerDataName = tower?.towerData?.name ?? "MISSING";
|
||||
Debug.Log($" {towerStatus} {prefab.name} - TowerDataComponent: {tower != null}, TowerData: {towerDataName}");
|
||||
}
|
||||
}
|
||||
|
||||
string[] towerDataGuids = AssetDatabase.FindAssets("t:TowerData", new[] { TOWER_DATA_PATH });
|
||||
Debug.Log($"<color=cyan>TowerData assets in Assets/Data/ScriptableObjects/:</color>");
|
||||
if (towerDataGuids.Length == 0)
|
||||
{
|
||||
Debug.Log($"<color=yellow>⚠ No TowerData assets found - Run 'Tools > Data > Import All CSV' first!</color>");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string guid in towerDataGuids)
|
||||
{
|
||||
string assetPath = AssetDatabase.GUIDToAssetPath(guid);
|
||||
TowerData data = AssetDatabase.LoadAssetAtPath<TowerData>(assetPath);
|
||||
string prefabStatus = data?.prefab != null ? "<color=green>✓</color>" : "<color=red>✗</color>";
|
||||
Debug.Log($" {prefabStatus} {data.name} - Prefab: {data?.prefab?.name ?? "MISSING"}, BuildingName: {data?.buildingName}");
|
||||
}
|
||||
}
|
||||
|
||||
BuildingManager buildingManager = GameObject.FindObjectOfType<BuildingManager>();
|
||||
Debug.Log($"<color=cyan>BuildingManager in Scene:</color>");
|
||||
if (buildingManager == null)
|
||||
{
|
||||
Debug.Log($"<color=red>✗ BuildingManager not found in scene!</color>");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"<color=green>✓ BuildingManager found: {buildingManager.gameObject.name}</color>");
|
||||
Debug.Log($"<color=cyan> Available Buildings: {buildingManager.availableBuildings.Count}</color>");
|
||||
foreach (var building in buildingManager.availableBuildings)
|
||||
{
|
||||
string status = building?.prefab != null ? "<color=green>✓</color>" : "<color=red>✗</color>";
|
||||
string isTower = building is TowerData ? "<color=green>[Tower]</color>" : "<color>yellow>[Building]</color>";
|
||||
Debug.Log($" {status} {isTower} {building?.name ?? "MISSING"} - {building?.buildingName}");
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"<color=cyan>========================================</color>");
|
||||
Debug.Log($"<color=cyan>[TowerPopulator] DIAGNOSIS COMPLETE</color>");
|
||||
Debug.Log($"<color=cyan>========================================</color>");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user