COMException in Unity 2020.3.25f1

Issue #81 new
Former user created an issue

I've taken the NuGet package and imported the .dll's that I wanted in the project from the /build and /runtimes folders, and on first attempt at using the AssimpContext.ImportFile(String) method with a very basic test monobehaviour to attempt to load from a file path when disabled; I am presented with a COMException with the message Rethrow as AssimpException: Error loading unmanaged library from path: assimp.dll.

I'm wondering if there is alot more that isn't told about the Unity plugin script or the dll's them selves that I'm somehow missing.

Here is the full callback from the error message:

COMException
Rethrow as AssimpException: Error loading unmanaged library from path: assimp.dll
Assimp.Unmanaged.UnmanagedLibrary+UnmanagedWindowsLibraryImplementation.NativeLoadLibrary (System.String path) (at <ce936998cfb2467c8902046cf55148fd>:0)
Assimp.Unmanaged.UnmanagedLibrary+UnmanagedLibraryImplementation.LoadLibrary (System.String path) (at <ce936998cfb2467c8902046cf55148fd>:0)
Assimp.Unmanaged.UnmanagedLibrary.LoadLibrary (System.String libPath) (at <ce936998cfb2467c8902046cf55148fd>:0)
Assimp.Unmanaged.UnmanagedLibrary.LoadLibrary () (at <ce936998cfb2467c8902046cf55148fd>:0)
Assimp.Unmanaged.UnmanagedLibrary.LoadIfNotLoaded () (at <ce936998cfb2467c8902046cf55148fd>:0)
Assimp.Unmanaged.AssimpLibrary.CreatePropertyStore () (at <ce936998cfb2467c8902046cf55148fd>:0)
Assimp.AssimpContext.CreateConfigs () (at <ce936998cfb2467c8902046cf55148fd>:0)
Assimp.AssimpContext.PrepareImport () (at <ce936998cfb2467c8902046cf55148fd>:0)
Assimp.AssimpContext.ImportFile (System.String file, Assimp.PostProcessSteps postProcessFlags) (at <ce936998cfb2467c8902046cf55148fd>:0)
Assimp.AssimpContext.ImportFile (System.String file) (at <ce936998cfb2467c8902046cf55148fd>:0)
AssimpNetTestImport.OnDisable () (at Assets/DEVTEST Scripts/AssimpNetTestImport.cs:12)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Comments (2)

  1. Nicholas Woodfield repo owner

    A COMException doesn’t make much sense for this, as the library doesn’t do any COM related thing, unmanaged or managed. LoadLibrary on windows basically boils down to this P/Invoke method:

                [DllImport("kernel32.dll", CharSet = CharSet.Ansi, BestFitMapping = false, SetLastError = true, EntryPoint = "LoadLibrary")]
                private static extern IntPtr WinLoadLibrary(String fileName);
    

    Both 32 and 64 bit unmanaged DLLs are named “assimp.dll”, I’d at least double check if you haven’t that the correct one is the one attempting to be loaded.

  2. Former user Account Deleted

    Hi, I’m the one who created this issue before making an account.

    I just wanted to correct my issue; I was getting that error seemingly because I wasn’t interacting with the AssimpContext method correctly. Tho I did find a code example from Google Code on AssimpNet and was able to call the Import method without the COM error message popping up in unity. On the other hand, the method returned an invalid path error even though I was passing in unity’s StreamingAssets access argument plus the file of interest, and the System.IO way. Both returned the same error.

    Also, just so this can help a little better; I’m using the 5.x-beta AssimpNet from NuGet, next time I get the chance and load assimpnet back into a unity project, I’ll try to reproduce the error message and provide the code with it.

  3. Log in to comment