38 lines
1020 B
C#
38 lines
1020 B
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using UnityEditor;
|
|
|
|
namespace Aliciza.UXTool
|
|
{
|
|
[System.Serializable]
|
|
[FilePath("ProjectSettings/UXPrefabTabsConfig.asset")]
|
|
internal class UXPrefabTabsConfig : ScriptableSingleton<UXPrefabTabsConfig>
|
|
{
|
|
public List<string> tabs = new();
|
|
|
|
public void SyncTabs()
|
|
{
|
|
var dirty = false;
|
|
for (int i = 0; i < tabs.Count; i++)
|
|
{
|
|
string assetPath = AssetDatabase.GUIDToAssetPath(tabs[i]);
|
|
#if UNITY_6000_OR_NEWER
|
|
if (string.IsNullOrEmpty(assetPath) || !AssetDatabase.AssetPathExists(assetPath))
|
|
{
|
|
tabs.RemoveAt(i);
|
|
dirty = true;
|
|
}
|
|
#else
|
|
if (string.IsNullOrEmpty(assetPath) || !File.Exists(assetPath))
|
|
{
|
|
tabs.RemoveAt(i);
|
|
dirty = true;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
if (dirty) Save();
|
|
}
|
|
}
|
|
}
|