Home > database >  Unity ClearScript - Importing DLL
Unity ClearScript - Importing DLL

Time:03-18

I'm trying to use ClearScript in Unity, but fail because Unity does not see the DLL. To be sure, I cloned the project and had the DLLs built. I did this using the instructions from ClearScript.

The goal is to use the DLL on HoloLens, which in turn means I have UWP as the platform and ARM64 as the architecture. But I also want to have valid references during the implementation in Unity and not have constantly grayed out code because of the scripting symbols (such as UNITY_WSA).

So what did I do?

  1. Screenshot - I took the dlls out of the output-net4.5-folder and set the api compatibility level in unity to .NET 4.x. The red ones are the dlls that I need and the blue ones only if I realy need to use V8, like already mentioned by the instruction from ClearScript.
  2. All the dlls, except "..win-x64|86.dll", are managed dlls and should work out of the box in unity. So this are the import settings for the managed dlls and the settings for the unmanaged|native dlls.

So what did I miss or what did I do wrong? I used in the past for example another javascript interpreter, called Jint, where I also just took the managed dll out of the .net-4.5-build folder, imported it under Assets/Plugins/Jint and used it in my code just by adding the using in my classes.

CodePudding user response:

I'm not sure if I should actually be happy or sad. Unity does what it feels like doing. The whole time (2 days) it didn't want to load the DLL for me. Just now I opened Unity for the 30th time and suddenly Unity recognized the DLL and listed it under references in the vs-unity-project.

So I doubted whether Unity, after making changes in Unity, actually reassembles the VS project.
What did I do to confirm the guess and what do you need to do to solve the problem?
I added a new DLL, this of course was not seen by unity and not referenced in the vs-unity-project. Then I deleted the solution file and the C# project file from the Unity project and restarted Unity. And when I reopened the VS Unity project (by opening a c# script), all the DLLs including the new DLL were suddenly referenced and the usings worked!

  • Related