You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm integrating the Image3dAPI and the GE loader to a Unity project. Based on the TestViewer example, it looks like the Image3dAPI can be integrated as a managed plugin to Unity. I was able to retrieve information such as the bounding box, and frame count in my Unity C# code, but when I try to access the data using GetFrame, an exception was thrown "marshaling conversion 22 not implemented". Further stack trace attached below:
at (wrapper managed-to-native) Image3dAPI.IImage3dSource.GetFrame(intptr,uint,Image3dAPI.Cart3dGeom,uint16[],Image3dAPI.Image3d&)
at (wrapper cominterop) Image3dAPI.IImage3dSource.GetFrame(uint,Image3dAPI.Cart3dGeom,uint16[])
at (wrapper cominterop-invoke) Image3dAPI.IImage3dSource.GetFrame(uint,Image3dAPI.Cart3dGeom,uint16[])
It seems the exception is because Unity C# uses Mono scripting backend which does not support SAFEARRAY in runtime. All APIs that return SAFEARRAY failed in Unity (returns null instead). Would it be possible to use a alternative type for arrays so that the library can be used in Unity?
The text was updated successfully, but these errors were encountered:
I'm sorry to hear about the limitation in Mono's scripting backend. I unfortunately don't think SAFEARRAY usage will be changed anytime soon, since v1 of the specification is already in commercial usage. We could consider changing it for future releases, but I fear it will lead to a more complex API. That's because it's valuable with a proper "array" object for managing image data. SAFEARRAY are also quite flexible, and facilitate both zero-copy in-process communication, copy-based out-of-process marshalling and zero-copy out-of-processing with shared memory. The latter is important for enabling security sandboxing without compromising on performance.
Have you attempted to contact Mono and suggest implementing SAFEARRAY support?
I'm integrating the Image3dAPI and the GE loader to a Unity project. Based on the TestViewer example, it looks like the Image3dAPI can be integrated as a managed plugin to Unity. I was able to retrieve information such as the bounding box, and frame count in my Unity C# code, but when I try to access the data using
GetFrame
, an exception was thrown "marshaling conversion 22 not implemented". Further stack trace attached below:It seems the exception is because Unity C# uses Mono scripting backend which does not support SAFEARRAY in runtime. All APIs that return SAFEARRAY failed in Unity (returns null instead). Would it be possible to use a alternative type for arrays so that the library can be used in Unity?
The text was updated successfully, but these errors were encountered: