From 74faa48a2884fc788e99ae51e283ce15d0344f3e Mon Sep 17 00:00:00 2001 From: Junrou Nishida Date: Sat, 2 Sep 2023 10:24:03 +0900 Subject: [PATCH] chore: change the default Asset Loader Type to Local --- .../Samples/Common/Scripts/AssetLoader.cs | 6 ------ .../Samples/Scenes/AppSettings.asset | 2 +- README.md | 19 +++++++++++++++---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/AssetLoader.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/AssetLoader.cs index 7153d80a8..a312f355a 100644 --- a/Assets/MediaPipeUnity/Samples/Common/Scripts/AssetLoader.cs +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/AssetLoader.cs @@ -5,7 +5,6 @@ // https://opensource.org/licenses/MIT. using System.Collections; -using UnityEngine; namespace Mediapipe.Unity.Sample { @@ -19,12 +18,7 @@ public static IEnumerator PrepareAssetAsync(string name, string uniqueKey, bool { if (_ResourceManager == null) { -#if UNITY_EDITOR - Debug.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); } diff --git a/Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset b/Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset index 84a9eff3c..9bc8a5ec6 100644 --- a/Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset +++ b/Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset @@ -14,7 +14,7 @@ MonoBehaviour: m_EditorClassIdentifier: _defaultImageSource: 0 _preferableInferenceMode: 0 - _assetLoaderType: 0 + _assetLoaderType: 2 _logLevel: 5 _glogMinloglevel: 0 _glogStderrthreshold: 2 diff --git a/README.md b/README.md index bcc8fcfd9..3cca507c4 100644 --- a/README.md +++ b/README.md @@ -117,14 +117,25 @@ Here is a list of [solutions](https://google.github.io/mediapipe/solutions/solut Select any scenes under `Mediapipe/Samples/Scenes` and play. -### Desktop +### Desktop, Android, iOS + +Select proper Inference Mode and Asset Loader Type from the Inspector Window. + +#### Preferable Inference Mode + +If you've built native libraries for CPU (i.e. `--desktop cpu`), select `CPU` for inference mode.\ +When building for Android/iOS, make sure that you select `GPU` for inference mode, because `CPU` inference mode is not supported currently. -If you've built native libraries for CPU (i.e. `--desktop cpu`), select `CPU` for inference mode from the Inspector Window. ![preferable-inference-mode](https://github.com/homuler/MediaPipeUnityPlugin/assets/4690128/129d18be-8184-43f7-8ac8-56db4df9f9a7) -### Android, iOS +#### Asset Loader Type + +The default Asset Loader Type is set to `Local`, which only works on UnityEditor.\ +To run it on your devices, switch it to `StreamingAssets` and copy the required resources under [`StreamingAssets`](https://docs.unity3d.com/2022.3/Documentation/Manual/StreamingAssets.html) (if you're using `MediaPipeUnityPlugin-all.zip`, the `StreamingAssets` directory already contains them). + +![asset-loader-type](https://github.com/homuler/MediaPipeUnityPlugin/assets/4690128/f7059140-4da9-4201-a232-83ff07cd63df) -Make sure that you select `GPU` for inference mode before building the app, because `CPU` inference mode is not supported currently. +See [the tutorial](https://github.com/homuler/MediaPipeUnityPlugin/wiki/Getting-Started#load-model-files) for more details. ## :book: Wiki