- Home /
ML.NET in unity
There is a new machine learning api from Microsoft, called ML.NET. I have tryed it and it is just great, but, cannot figure out how to use it in unity. The ML examples are done in Visual Studio projects that target 64 bit processors and are of type .NET Core.
As unity does not support that I am guessing my best bet is to try building a .dll api project and importing it into Unity:
I have tryed building an xxxx.dll api(.net core 2.0 class library) and copyed it into /Assets/plugins folder, but when typing a using xxxx; statement it is as though it was not there. I have also tryed building a framework api but ML suport starts at framework version 4.6.1, and if I build that version, Unity does not recognise the xxxx.dll either. The same goes for the .net standard api bild.
So I guess my question is: How can I use ML.NET in unity?
By changeing reference framework from 3.5 to 4.x equivalent, I managed to import the api built as framework 4.6.1 with aded reference to $$anonymous$$L.NET , But as soon as I add some $$anonymous$$L methods to my api the unity editor reports an error , saying my api is not compatible or sth. The same goes for an api built as core 2.0 project. Please help!
You going UWP or Standalone? If UWP, check the part about placeholder out:
https://docs.unity3d.com/$$anonymous$$anual/windowsstore-plugins.html
I have tryed all sorts of combos in player setings and in plugin settings. But have not tried building the app. Not shure what difference this would make... @hexagonius I was hopieing to build for standalone and android though. But this error persisits even if I exclude UWP from plugin selected platforms. I have reported an issue in github $$anonymous$$L.NET repository. Hope someone checks it out soon, aldo I am not entirely shure if it is a $$anonymous$$L or a Unity issue.
@hexagonius You can dowload a small VS project and an example Unity project in https://github.com/dotnet/machinelearning/issues/1886 . Just unzip and start unity project, the error is shown as soon as the Unity editor starts, no need to press play.
Answer by AfroDieter · Mar 03, 2019 at 11:56 AM
I had a similar problem when trying to use OracleDataAccess.dll.
I think unity uses different implementations of Core.net classes. These do then not work with dlls built for the standard .net stuff. In my case with the oracle stuff I basically had to build a seperate application on a webserver that was called by my unity project.
So I guess there is no easy or even acceptable way for your usecase. Sorry.