Quantcast
Channel: Questions in topic: "dll"
Viewing all articles
Browse latest Browse all 706

Problems compiling DLL for use with Unity's current version (2019.2.0f1)

$
0
0
Trying to create a new DLL for use with Unity. I never had problems beyond minor-ones with this before, but now, after upgrading to the latest version of Unity, I’m unable to get some new DLL projects to compile. I follow, exactly the steps provided in the online documentation( https://docs.unity3d.com/Manual/UsingDLL.html ):

But I still got the following error when I try to compile it (not the main issue here):

`The type or namespace name 'MonoBehaviour' could not be found (are you missing a using directive or an assembly reference?)`

I ensured that the file C:\Program Files\Unity\Editor\Data\Managed\UnityEngine\UnityEngine.dll is present in the project references. (this is the path specified on docs page)

So I Replaced that reference with: C:\Program Files\Unity\Editor\Data\Managed\UnityEngine.dll (different from docs, but how I had my previous DLL projects setup) and it worked. (Re-reading the docs, I see this was my mistake.. the docs DO have the correct path.)

Ok, great. Then I attempted to use “Selectable”, a class defined in the UnityEngine.UI namespace

First issue: the ONLY UnityEngine.UI.DLL I can find on my PC, is in my Unity project’s (oft deleted) “Library” folder, but when I add it as a reference, to the DLL project, I get a ton of warnings, and an error similar to the original error.

Warnings after adding UnityEngine.UI.dll reference:

`The primary reference "UnityEngine.UI" could not be resolved because it has an indirect dependency on the .NET Framework assembly "Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework`.

Error after adding UnityEngine.UI.dll reference:

`The type 'MonoBehaviour' is defined in an assembly that is not referenced. You must add a reference to assembly 'UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.`

Not clear on how the USER of my custom DLL supposed to get this file that now exists only in my project folder, not my “system” folders. Surely I’m not supposed to package the UnityEngine.UI.DLL file with my custom DLL, or am I? I also notice that if I remove the code from my project that uses UnityEngine.UI, and recompile the unity project, the UnityEngine.UI.DLL vanishes!

What’s going on here, why is the UnityEngine.UI.dll file not-permanent?

Why isn’t it compiling as expected?

What files SHOULD I be referencing in my DLL project and how is this determined?

What DLL files, if any, will I need to distribute with my DLL?

(Not sure if it's actually related to this issue: I found some references to "Package Manager" in the forums, I went in there, and DO see "Unity UI".. but the only option it provides me, is to "remove" it.) Edit: code.. I didn't include it because it's so minimal.. but here it is just-incase: using UnityEngine; using UnityEngine.UI; public class MonoDerived : MonoBehaviour { public Selectable selectableRef; }

Viewing all articles
Browse latest Browse all 706

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>