question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DllNotFoundException: mediapipe_c | NullReferenceException: Object reference not set to an instance of an object

See original GitHub issue

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 20.04, WSL2): Windows
  • Target (e.g. desktop cpu, android arm64): desktop cpu
  • Bazel version: 4.1.0
  • Python version: 3.7.8
  • GCC/G++ version: 19.16.27045 for x64
  • Unity version: 2020
  • Android NDK version (if building for Android):
  • Xcode version (if building for iOS):

Describe the problem Plugins: Failed to load ‘C:/Users/arham/Documents/extras/MediaPipeUnityPlugin/Packages/com.github.homuler.mediapipe/Runtime/Plugins/libmediapipe_c.dll’ because one or more of its dependencies could not be loaded.

Steps to reproduce the issue I tried to open in editor by clicking over DemoDesktop scene. Also tried to import it as package, Even I also reinstalled the Unity 2020.

Full logs

Plugins: Failed to load 'C:/Users/arham/Documents/extras/MediaPipeUnityPlugin/Packages/com.github.homuler.mediapipe/Runtime/Plugins/libmediapipe_c.dll' because one or more of its dependencies could not be loaded.
DllNotFoundException: mediapipe_c
Mediapipe.ResourceManager..ctor () (at Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/ResourceManager.cs:20)
Mediapipe.LocalAssetManager..ctor () (at <e2b237ecb26f4097b4aa4033f48ffa11>:0)
LocalAssetLoader.Start () (at Assets/Mediapipe/Samples/Scripts/ResourceManager/LocalAssetLoader.cs:5)
NullReferenceException: Object reference not set to an instance of an object
LocalAssetLoader.PrepareAsset (System.String name, System.String uniqueKey, System.Boolean overwrite) (at Assets/Mediapipe/Samples/Scripts/ResourceManager/LocalAssetLoader.cs:9)
DemoGraph.PrepareDependentAsset (System.String assetName, System.String uniqueKey, System.Boolean overwrite) (at Assets/Mediapipe/Samples/Scripts/DemoGraph.cs:192)
DemoGraph.PrepareDependentAsset (System.String assetName, System.Boolean overwrite) (at Assets/Mediapipe/Samples/Scripts/DemoGraph.cs:196)
FaceDetectionGraph.PrepareDependentAssets () (at Assets/Mediapipe/Samples/Graphs/FaceDetection/Scripts/FaceDetectionGraph.cs:57)
DemoGraph.Initialize () (at Assets/Mediapipe/Samples/Scripts/DemoGraph.cs:46)
SceneDirector+<RunGraph>d__23.MoveNext () (at Assets/Mediapipe/Samples/Scripts/SceneDirector.cs:171)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e414e10bfe5f45729ff122f3359de21b>:0)

Additional context Even I ignore this DLL error and run the scene but it is producing following error:

NullReferenceException: Object reference not set to an instance of an object
LocalAssetLoader.PrepareAsset (System.String name, System.String uniqueKey, System.Boolean overwrite) (at Assets/Mediapipe/Samples/Scripts/ResourceManager/LocalAssetLoader.cs:9)
DemoGraph.PrepareDependentAsset (System.String assetName, System.String uniqueKey, System.Boolean overwrite) (at Assets/Mediapipe/Samples/Scripts/DemoGraph.cs:192)
DemoGraph.PrepareDependentAsset (System.String assetName, System.Boolean overwrite) (at Assets/Mediapipe/Samples/Scripts/DemoGraph.cs:196)
FaceDetectionGraph.PrepareDependentAssets () (at Assets/Mediapipe/Samples/Graphs/FaceDetection/Scripts/FaceDetectionGraph.cs:57)
DemoGraph.Initialize () (at Assets/Mediapipe/Samples/Scripts/DemoGraph.cs:46)
SceneDirector+<RunGraph>d__23.MoveNext () (at Assets/Mediapipe/Samples/Scripts/SceneDirector.cs:171)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e414e10bfe5f45729ff122f3359de21b>:0)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
homulercommented, Aug 3, 2021

It usually occurs when you start Unity before building native libraries (Unity removes .meta files). cf. https://github.com/homuler/MediaPipeUnityPlugin/issues/186#issuecomment-851253589

Even after setting “Load on startup” the error comes back when i restart unity.

On Windows, please just ignore this error if it works. It seems that libmediapipe_c.dll must be loaded after OpenCV but we cannot specify the order.

0reactions
Arham-Aalamcommented, Aug 3, 2021

Thanks @homuler it worked, In my case I was using OpenCV 3.4.15 So my DLL file was opencv_world3415.dll but the meta file was opencv_world3410.dll.meta, So instead of changing my OpenCV version I try to rename meta as opencv_world3415.dll.meta and it worked! Also don’t forget to enable “Load on startup” for opencv DLL file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object reference not set to an instance of an object
NullReferenceException : Object reference not set to an instance of an object in line 21 and still can't understand why.
Read more >
Failed to load libmediapipe_c.dll · Issue #186
I'm not sure what you mean, but this project is independent of ... NullReferenceException: Object reference not set to an instance of an ......
Read more >
Object reference not set to an instance of an object.
the error indicates an object is null. Either strSearch is null or the result of strSearch.Trim() is null. To check, use Graphain's answer...
Read more >
Object reference not set to the instance of an object - Unity
This is an error message that plagues many newcomers to unity, and so I thought I would make a short tutorial dressing what...
Read more >
NullReferenceException: Object reference not set to an ...
His console only writes one error: "Null ReferenceException: object reference not set to an instance of an object".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found