Files
speckle-unity/Packages/systems.speckle.speckle-unity/Runtime/NativeCacheFactory.cs
T
2023-08-31 12:08:35 +01:00

49 lines
1.3 KiB
C#

using System.Collections.Generic;
using Speckle.ConnectorUnity.NativeCache;
using UnityEngine;
#if UNITY_EDITOR
using Speckle.ConnectorUnity.NativeCache.Editor;
#endif
namespace Speckle.ConnectorUnity
{
#nullable enable
public static class NativeCacheFactory
{
public static List<AbstractNativeCache> GetDefaultNativeCacheSetup(
bool generateAssets = false
)
{
#if UNITY_EDITOR
if (generateAssets)
{
return GetEditorCacheSetup();
}
#endif
return GetStandaloneCacheSetup();
}
public static List<AbstractNativeCache> GetStandaloneCacheSetup()
{
return new List<AbstractNativeCache>()
{
ScriptableObject.CreateInstance<ResourcesNativeCache>(),
ScriptableObject.CreateInstance<MemoryNativeCache>(),
};
}
#if UNITY_EDITOR
public static List<AbstractNativeCache> GetEditorCacheSetup()
{
return new List<AbstractNativeCache>()
{
ScriptableObject.CreateInstance<ResourcesNativeCache>(),
ScriptableObject.CreateInstance<AssetDBNativeCache>(),
ScriptableObject.CreateInstance<MemoryNativeCache>(),
};
}
#endif
}
}