Есть скрипт:
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class AList
{
public List<BList> bLists;
}
[System.Serializable]
public class BList
{
public int a;
public int b;
}
public class Test1 : MonoBehaviour
{
public List<AList> aLists;
}
И "Custom Editors" :
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Test1))]
public class Test1Editor : Editor
{
private Test1 test1;
public void OnEnable()
{
test1 = (Test1)target;
}
public override void OnInspectorGUI()
{
if (test1.aLists.Count > 0)
{
foreach (AList aList in test1.aLists)
{
EditorGUILayout.BeginVertical("box");
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("X", GUILayout.Width(40), GUILayout.Height(40)))
{
test1.aLists.Remove(aList);
break;
}
EditorGUILayout.EndHorizontal();
if (aList.bLists.Count > 0)
{
}
EditorGUILayout.EndVertical();
}
}
if (GUILayout.Button("Create new AList", GUILayout.Height(30)))
{
test1.aLists.Add(new AList());
}
}
}
При нажатии кнопки: "Create new AList"
Выдаёт ошибку:
Проблема в:
if (aList.bLists.Count > 0)
{
}
Мой Editor не видит BList, в чём может быть проблема?