Why does the following error occur when compiling this assembly?

I am trying to use the following command line command to compile code assembly from my project:

C:/"Program Files"/Unity/Editor/Data/Mono/bin/gmcs -target:library -out:C:/Users/Austin/Desktop/PixelExpanse.dll -recurse:C:/Users/Austin/Desktop/Projects/Repos/trunk/PixelExpanse/SpaceColonyRefactor/Assets/Source/*.cs -d:RUNTIME -r:C:/"Program Files"/Unity/Editor/Data/Managed/UnityEngine.dll 

As you can see, I, I believe, correctly refer to UnityEngine.dll . The code to be compiled contains links to UnityEngine.UI and UnityEngine.EventSystems . But when I run the above command, I get the following compilation error:

error CS0234: The type or name of the EventSystems namespace does not exist in the UnityEngine namespace. Are you missing an assembly link?

From what I could find through googling, it WATCHES like an error that people received when using builds up to 4.6, because EventSystems and UI were introduced then. But I don’t know how I can miss that in the dll I mention how Unity 5 is the only version that has ever touched this computer.

As a note, I submitted this question to Unity Answers and have not yet received an answer. I expect, because building an assembly goes beyond what most users do there. So I ask him here.

+6
source share
4 answers

The UnityEngine.EventSystems namespace really appears in UnityEngine.UI.dll , not UnityEngine.dll , so it seems you need to also refer to the first one when you compile the command line manually. Unity projects have this by default (see below).

This is confirmed by the opening of the assembly in your reflex instrument of choice, here I use JetBrains dotPeek:

enter image description here

Here's what my test project looks like with default Unity links. Note that, by default, a link to UnityEngine.UI has already appeared in a project created by Unity:

enter image description here

When I built the Windnows desktop application through Unity, the above DLLs appeared in:

<drive>: <projectOutFolder> \ <projectName> _Data \ Managed

+6
source

I checked UnityEngine.dll and the Eventsystems / UI namespace is not included. Despite this, in Unity5 \ Editor \ Data \ UnityExtensions \ Unity \ GUISystem \ UnityEngine.UI.dll there is a dll that includes these namespaces.

+2
source

You can try:

right-click on the "project bar" and after "Reimport All."

This may be due to switching between platforms, for example. IOS or Desktop .. so folrders are deleted and this becomes unnecessary.

Decide for me: Unity 5.2, Win 7, 32bits;

Good luck

+1
source

For mac, it /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll .

0
source

Source: https://habr.com/ru/post/988746/


All Articles