Files
plugin-library/Assets/00.StaryEvo/Runtime/PlayerSettings/ArtSceneData.cs

43 lines
1.3 KiB
C#
Raw Normal View History

2025-10-24 19:08:10 +08:00
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEditor;
using UnityEngine;
2025-10-31 11:18:23 +08:00
namespace Stary.Evo
2025-10-24 19:08:10 +08:00
{
[CreateAssetMenu(fileName = "ArtSceneData", menuName = "Evo/ArtSceneData")]
public class ArtSceneData : ScriptableObject
{
[ListDrawerSettings(DraggableItems = false, ShowFoldout = false, ShowPaging = false, ShowItemCount = false)]
public List<ArtScene> artScenes = new List<ArtScene>();
}
[System.Serializable]
public class ArtScene
{
2025-10-31 11:18:23 +08:00
[LabelText("场景名称")] public string sceneName;
2025-10-31 12:27:49 +08:00
#if UNITY_EDITOR
2025-10-31 11:18:23 +08:00
[LabelText("场景实例")] [OnValueChanged("LoadScenePath")]
2025-10-24 19:08:10 +08:00
public SceneAsset sceneAsset;
2025-10-31 12:27:49 +08:00
#endif
2025-10-31 11:18:23 +08:00
[LabelText("场景路径")] [ReadOnly] public string scenePath;
[LabelText("场景标识符")] [ReadOnly] public string sceneIdentifier;
#if UNITY_EDITOR
2025-10-24 19:08:10 +08:00
public void LoadScenePath()
{
if (sceneAsset == null)
{
Debug.LogError($"ArtScene {sceneName} 资源不存在,请检查!");
return;
}
2025-10-31 11:18:23 +08:00
2025-10-24 19:08:10 +08:00
scenePath = AssetDatabase.GetAssetPath(sceneAsset);
2025-10-31 11:18:23 +08:00
sceneIdentifier = $"Scenes_{sceneAsset.name}";
AssetDatabase.SaveAssets();
2025-10-24 19:08:10 +08:00
}
2025-10-31 11:18:23 +08:00
#endif
2025-10-24 19:08:10 +08:00
}
}