forked from homuler/MediaPipeUnityPlugin
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAssetLoader.cs
More file actions
39 lines (34 loc) · 1.09 KB
/
Copy pathAssetLoader.cs
File metadata and controls
39 lines (34 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2021 homuler
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
using System.Collections;
namespace Mediapipe.Unity
{
public static class AssetLoader
{
private static ResourceManager _ResourceManager;
public static void Provide(ResourceManager manager)
{
_ResourceManager = manager;
}
public static IEnumerator PrepareAssetAsync(string name, string uniqueKey, bool overwrite = false)
{
if (_ResourceManager == null)
{
#if UNITY_EDITOR
Logger.LogWarning("ResourceManager is not provided, so default LocalResourceManager will be used");
_ResourceManager = new LocalResourceManager();
#else
throw new System.InvalidOperationException("ResourceManager is not provided");
#endif
}
return _ResourceManager.PrepareAssetAsync(name, uniqueKey, overwrite);
}
public static IEnumerator PrepareAssetAsync(string name, bool overwrite = false)
{
return PrepareAssetAsync(name, name, overwrite);
}
}
}