73 lines
2.9 KiB
C#
73 lines
2.9 KiB
C#
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
namespace GameSystems.Optimization.Editor
|
|
{
|
|
[CustomEditor(typeof(PlayerRangeManager))]
|
|
public sealed class PlayerRangeManagerEditor : UnityEditor.Editor
|
|
{
|
|
private SerializedProperty _configProperty;
|
|
private SerializedProperty _parentsProperty; // ⭐ 변수명 일치
|
|
|
|
private void OnEnable()
|
|
{
|
|
_configProperty = serializedObject.FindProperty("_config");
|
|
// ⭐ [에러 해결] 리스트 이름 '_environmentParents'를 정확히 찾아옵니다.
|
|
_parentsProperty = serializedObject.FindProperty("_environmentParents");
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
PlayerRangeManager manager = (PlayerRangeManager)target;
|
|
serializedObject.Update();
|
|
|
|
// === 헤더 ===
|
|
DrawMainHeader(); // ⭐ [경고 해결] DrawHeader 이름을 DrawMainHeader로 변경
|
|
|
|
EditorGUILayout.Space(5);
|
|
|
|
// === 설정 영역 ===
|
|
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
|
GUILayout.Label("필수 설정", EditorStyles.boldLabel);
|
|
EditorGUILayout.PropertyField(_configProperty);
|
|
|
|
// ⭐ [에러 해결] 리스트를 안전하게 그립니다.
|
|
if (_parentsProperty != null)
|
|
{
|
|
EditorGUILayout.PropertyField(_parentsProperty, new GUIContent("Environment Parents"), true);
|
|
}
|
|
|
|
EditorGUILayout.EndVertical();
|
|
|
|
// === 실시간 통계 ===
|
|
if (Application.isPlaying && manager.IsInitialized)
|
|
{
|
|
EditorGUILayout.Space(5);
|
|
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
|
GUILayout.Label("실시간 통계", EditorStyles.boldLabel);
|
|
EditorGUILayout.LabelField("총 오브젝트:", manager.TotalObjectCount.ToString());
|
|
EditorGUILayout.LabelField("표시 중:", manager.VisibleObjectCount.ToString());
|
|
EditorGUILayout.LabelField("컬링 효율:", $"{(manager.CullingEfficiency * 100f):F1}%");
|
|
EditorGUILayout.EndVertical();
|
|
}
|
|
|
|
EditorGUILayout.Space(5);
|
|
|
|
// === 컨트롤 버튼 ===
|
|
if (GUILayout.Button("🔄 오브젝트 목록 새로고침", GUILayout.Height(30)))
|
|
{
|
|
if (Application.isPlaying) manager.RefreshObjectList();
|
|
}
|
|
|
|
serializedObject.ApplyModifiedProperties();
|
|
if (Application.isPlaying) Repaint();
|
|
}
|
|
|
|
private void DrawMainHeader() // ⭐ 이름 변경됨
|
|
{
|
|
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
|
GUILayout.Label("Player Range Manager", new GUIStyle(EditorStyles.boldLabel) { fontSize = 14, alignment = TextAnchor.MiddleCenter });
|
|
EditorGUILayout.EndVertical();
|
|
}
|
|
}
|
|
} |