Skip to content

Commit

Permalink
chore: change the default Asset Loader Type to Local (#1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Sep 2, 2023
1 parent 806ea46 commit b3e86f9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
6 changes: 0 additions & 6 deletions Assets/MediaPipeUnity/Samples/Common/Scripts/AssetLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// https://opensource.org/licenses/MIT.

using System.Collections;
using UnityEngine;

namespace Mediapipe.Unity.Sample
{
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/MediaPipeUnity/Samples/Scenes/AppSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
_defaultImageSource: 0
_preferableInferenceMode: 0
_assetLoaderType: 0
_assetLoaderType: 2
_logLevel: 5
_glogMinloglevel: 0
_glogStderrthreshold: 2
Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b3e86f9

Please sign in to comment.