7

I'm attempting to use the following command line command to compile an assembly of the code 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 am, I believe, correctly referencing the UnityEngine.dll. The code that would be compiled contains references to UnityEngine.UI and UnityEngine.EventSystems. But when I run the above command, I get the following compile error:

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

From what I have been able to find through googling, it SEEMS like an error people were getting when using a pre-4.6 assembly, because thats when EventSystems and UI were both introduced. But I don't know how I could be missing that in the dll I'm referencing as Unity 5 is the only version that has ever touched this computer.

As a side note, I have posted this question to Unity Answers and have yet to receive a response. I expect it's because assembly compilation is beyond the scope of what most users there choose to undertake. Hence my asking it here.

2
  • 1
    Are you able to open UnityEngine with Reflector or a similar tool and see whether the expected types are in there?
    – Jon Skeet
    Jun 9, 2015 at 5:49
  • Some users arriving here may want to know, to fix this, sometimes you need to put the class files in a folder named Editor e.g. for TestTools and such.
    – vazor
    Jun 28, 2018 at 21:12

4 Answers 4

6

The namespace UnityEngine.EventSystems actually appears in UnityEngine.UI.dll and not UnityEngine.dll so it seems you need to reference the former too when compiling manually from the command-line. Unity projects have this by default (see below).

This is verified by opening up the assembly in your reflector tool of choice, here I am using JetBrains dotPeek:

enter image description here

This is how my test project appears with default Unity references. Note that by default a reference to UnityEngine.UI already appears in the Unity-created project:

enter image description here

When I built my Windnows desktop app via Unity, the above dlls appeared in:

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

2

You can try:

right click on "project panel", and after "Reimport All".

It's can be happen due to switch between platforms, e.g. IOS, or Desktop.. thus, folrders are deleted by became unecessary..

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

Good luck!

1
  • Worked for me on Mac too - MacOS 10.15.5, Unity 2019.3.10f1 Jul 4, 2020 at 10:38
2

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

3
  • Ups. That was a typo. I meant EventSystems Jun 9, 2015 at 9:05
  • Thanks. That's interesting though, is it a doco error on their part I wonder then?
    – user585968
    Jun 9, 2015 at 9:08
  • Im not sure, but it is declarated as "Extension" and the UI is a OpenSource component. maybe its better to maintain that way Jun 9, 2015 at 9:13
0

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

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.