ScenePartition/Editor/ScenePartitionSS.cs
2023-06-27 00:24:46 +02:00

28 lines
977 B
C#

using UnityEditor;
using UnityEngine;
namespace VertexColor.ScenePartition.Editor
{
[FilePath("ScenePartition/SceneDataCache.asset", FilePathAttribute.Location.ProjectFolder)]
public class ScenePartitionSS : ScriptableSingleton<ScenePartitionSS>
{
public SceneDataCache SceneDataCache => sceneDataCache;
[SerializeField]
private SceneDataCache sceneDataCache = new SceneDataCache();
public ScenePartitionData GetScenePartitionData(ScenePartitionSO scenePartitionSO)
{
if (!sceneDataCache.TryGetValue(scenePartitionSO, out ScenePartitionData scenePartitionData))
{
scenePartitionData = new ScenePartitionData();
sceneDataCache.Add(scenePartitionSO, scenePartitionData);
}
return scenePartitionData;
}
}
[System.Serializable]
public class SceneDataCache : SerializableDictionary<ScenePartitionSO, ScenePartitionData> { }
}