UnityEditor.UI reference missing

Hi all,

As stated in this Unity Answers thread, the UnityEditor.UI is not accessible for import. “using UnityEditor.UI” does not compile.

The problem in that thread was not propelrly understood so I am writing a forum post in addition.

Basically, I want to write a custom inspector for a new control, but I cannot specialize the UnityEditor.UI.SelectableEditor. The code for SelectableEditor shows that it is embeded in the UnityEditor.UI namespace, but the namespace does not seem to be accessible.

The workaround is to copy the full code of the SelectableEditor and add the new control specific properties, but it is obviously not optimal.

The problem appears both in Unity 4.6.0 and Unity 4.6.1

Thanks!

1 Like

The problem exist under Unity 5 too.

You do not have to copy any code. Simply update the references. You have to manually add the reference to the DLL each time a sync was done of the project file.

You can find the DLL to include under C:\Program Files\Unity\Editor\Data\UnityExtensions\Unity\GUISystem\Editor\UnityEditor.UI.dll (don’t know the path structure on OSX - just check where the reference for UnityEngine.UI.dll points to and you will figure it out).

[edit]

I reported this as a bug.

The solution (for now) is to create a .csproj.user and add the reference in it. When Unity does a sync it will update the .csproj but leave your .csproj.user alone.

I use Visual Studio and it will also load info from the csproj.user. I guess MonoDevelop would support this too.

The file you want to add will be named “Assembly-CSharp-Editor-vs.csproj.user” and perhaps Assembly-CSharp-Editor.csproj.user - just look at what the project is named that contains the source which needs the reference.

Included this alongside the solution file and the other project files of the project. This is one directory up from where your project /Assets/ folder is.

Add this. Fix the Path if you installed Unity somewhere else or are on OSX.

  <?xml version="1.0" encoding="utf-8"?>
  <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <ItemGroup>
       <Reference Include="UnityEditor.UI">
         <HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/Editor/UnityEditor.UI.dll</HintPath>
       </Reference>
     </ItemGroup>
  </Project>

All editor related scripts should be placed into “Editor” directory anywhere in the project, apparently.

I had the same issue and i was stuck for several hours, the thing that helped me is: re-import the project
Assets-> re-import . it could take several hours according to the size of your project, however, it would take negligible amount of time for small projects.