- Home /
Unity and external DLL loading problems
Hi guys, today I was interested in the possibility to use a thermal printer with unity (just a simple print). I found out that Microsoft has released this set of libraries called POS (Point of Service) that handle very well the interaction between a C# project and a lot of printers.
I tried it our with a very simple C# project it works fine, I just had to install POS and set the reference for the DLL needed. I then tried it inside a Unity scrpit, I put the DLL inside the Plugins folder and it was correctly loaded.
There are no compile errors and it plays without any problem until it reaches the very first line of code in the script where an object from a class defined inside the POS DLL is created (basically the first line that uses something from the DLL).
I can't really understend the error, the documentation is basically non existant and I can't debug inside the DLL. Now the problem is clearly with Unity and its use of external DLL.
Additional information: I used the .NET 4.x compatibility because these DLL are for that. I also tried with older versions of POS that works with <4 .NET but the same line generates another exception (something like Unity isn't able to load the DLL or something else that it requires).
Is it normal that Unity can't use properly DLL that a normal C# project can (the exact same code works fine there)? Is there some trick?
PS: I also tried to insert the whole POS directory (very small, only a few files) inside PLUGINS but nothing has changed
Which version of $$anonymous$$icrosoft.PointOfService were you using? did your stack trace end with $$anonymous$$icrosoft.PointOfService.Pos4NetTelemetry.IsCeipOptInEnabled ? did you ever figure out how to fix this?
what are the dll's for exactly? if NET 2.0 Standard, should work. NET Framework, might not. NET Core, not at all.
they reference 2.0 and work in 4.x. I'm starting to think it has something to do with security and accessing the registry.