MATLAB Answers

0

making MWArray.dll work under unity3d 2018

Asked by metzger mike on 16 Sep 2018
Latest activity Answered by Gianluca Clemente on 11 Oct 2018
Hello,
I have a problem with the MWArray.dll wich is the original dll library from mathworks compiled from Matlab. This dll work under visual studio but not under unity. The goal was to compile under matlab a simple function mycos wich calculate a cosinus and use it under unity with the second dll MWArray mathworks library.
I made a test under visual studio and it work well, i have no problem to read the dll and make a call to the mycos.dll class. I made a typical c# project with two references on MWArray and mycos.
But when i try under unity, by putting the two dll under a plugins folder and configure unity 2018 on .NET 4.0 because the dll are compiled with the .NET framework 4.0. Unity can read the dll but when running it make an error NotImplementedException: The requested feature is not implemented. System.Security.Principal.WindowsIdentity.GetCurrent (Boolean ifImpersonating) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Security.Principal/WindowsIdentity.cs:166)
If i want to use matlab is for a research project wich was coded in matlab with advanced high level math functions wich gonna be difficult to recode under unity with c#. So the easy way is to use compiled package from matlab compiler. So is there someone who did this already ?

  1 Comment

I have the same identical problem. Did you solve it?

Sign in to comment.

Products


Release

R2017b

1 Answer

Answer by Gianluca Clemente on 11 Oct 2018

The solution consists in NOT using MWArray.dll in Unity project because of incompatibility with Mono. Create a Visual Studio project (when creating new select the type "console applicatiion"), it MUST be separated from unity project directory, and use it as an application server; in fact in that app you can use MWArray.dll, remember that you have to configure your project configuration to x64!!! In the Unity project create a client app to communicate with the other server project.

  0 Comments

Sign in to comment.