Home > Net >  Unity : I can't reference my managed plugin into my test project
Unity : I can't reference my managed plugin into my test project

Time:10-08

Beginning at Unity.

I have made my unity project. I have added a C# SimAnt.dll project of mine as a managed project into the unity project. I have created an EditMode test Asset into the unity project.

At this stage, if I can make a test and run it OK. I can instantiate classes from SimAnt project into the unity project scripts.

But I do not manage to reference SimAnt project into the test project. I understand where I should do it into the UI:

enter image description here

But the SimAnt project is not available into the list of projects that I can reference :(

enter image description here

I have also tried to add the reference directly into the test project via VS. If I do so, the test project correctly sees the Simant Dll classes as I would expect into VS UI, but the Unity interface still complains about the reference: error CS0246: The type or namespace name 'SimAnt' could not be found (are you missing a using directive or an assembly reference?)

I tried including my SimAnt dll into the .asmdef file of the test project via VS. I am not sure about the syntax though:

enter image description here

My Assets directory is like this:

enter image description here

I closed / reopened Unity after adding the reference from VS, no luck.

Any idea?

EDIT: requested screenshots of the editor:

enter image description here

enter image description here

CodePudding user response:

I Got it!!!!

I was trying to add the plugin into the wrong box.

The plugins (copy pasted DLL) need to be added into the "Assembly references" tab. (2 in screenshot below).

The other projects assemblies need to be added into the "Assembly Definitions References" tab (1 in screenshot below).

enter image description here

PS : You can add as a plugin the dll file compiled in Debug. It does not have to be the Release compiled file. I had a doubt about this part.

  • Related