39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using Sirenix.OdinInspector.Editor;
|
|||
|
|
using Stary.Evo;
|
|||
|
|
using Stary.Evo.Editor;
|
|||
|
|
using UnityEditor;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
namespace Stary.Evo.Editor
|
|||
|
|
{
|
|||
|
|
[CustomEditor(typeof(ArtSceneData))]
|
|||
|
|
public class ArtSceneDataEditor : OdinEditor
|
|||
|
|
{
|
|||
|
|
// /// <summary>
|
|||
|
|
// /// 序列化属性,在OnEnable中获取
|
|||
|
|
// /// </summary>
|
|||
|
|
// [HideInInspector] private SerializedProperty artScenes;
|
|||
|
|
private void OnEnable()
|
|||
|
|
{
|
|||
|
|
//artScenes = serializedObject.FindProperty("artScenes");
|
|||
|
|
ArtSceneData artSceneData = (ArtSceneData)target;
|
|||
|
|
List<ArtScene> artScenesList = artSceneData.artScenes;
|
|||
|
|
List<int> removeIndexList = new List<int>();
|
|||
|
|
for (int i = 0; i < artScenesList.Count; i++)
|
|||
|
|
{
|
|||
|
|
ArtScene artScene = artScenesList[i];
|
|||
|
|
if (artScene.sceneAsset==null)
|
|||
|
|
{
|
|||
|
|
removeIndexList.Add(i);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
for (int i = removeIndexList.Count - 1; i >= 0; i--)
|
|||
|
|
{
|
|||
|
|
int index = removeIndexList[i];
|
|||
|
|
artScenesList.RemoveAt(index);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|