I am currently having an issue with the Navigation struct in Unity UI 1.0.0, and I have run out of things to try.
The project I am working on is an older project, originally developed in Unity 2018.2. I had to stop working on this project for a long time, and recently had to pick it up again. I am now attempting to upgrade the project to Unity 2019.3, but I am running into quite the snag now that Unity UI has been moved to the Package Manager.
For my project, I rely on a number of existing company libraries. I have placed these DLLs in the Assets\Libs directory. Part of these libraries live in the Navigation.* namespace. This is where I start running into the following errors:
C:\Program Files\Unity\Hub\Editor\2019.3.13f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Editor\UI\PropertyDrawers\NavigationDrawer.cs(6,34): error CS0118: 'Navigation' is a namespace but is used like a type
C:\Program Files\Unity\Hub\Editor\2019.3.13f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Editor\UI\PropertyDrawers\NavigationDrawer.cs(65,27): error CS0234: The type or namespace name 'Mode' does not exist in the namespace 'Navigation' (are you missing an assembly reference?)
These are the lines in the NavigationDrawer class that are throwing the errors:
[CustomPropertyDrawer(typeof(Navigation), true)]
public class NavigationDrawer : PropertyDrawer
{
[...]
static Navigation.Mode GetNavigationMode(SerializedProperty navigation)
{
return (Navigation.Mode)navigation.enumValueIndex;
}
[...]
}
The Navigation referenced by this class is a struct that is part of the UnityEngine.UI namespace: https://docs.unity3d.com/Packages/com.unity.ugui@1.0/api/UnityEngine.UI.Navigation.html
It seems that the classes in the *[…]\PackageManager\BuiltInPackages\com.unity.ugui\Editor\UI* folder are getting compiled against my imported libraries. Furthermore, I couldn’t find the Navigation struct within that folder.
I am somewhat at a loss as to what to do. I can’t change the namespace on my libraries. I use Unity UI for a number of existing controls in my project. Trying to create a Navigation struct in my own code made no difference. Changing the NavigationDrawer.cs code isn’t much of an option since this project is shared among a team and I’d rather not have every one of us have to change the code manually.
One more thing I can still think of is to get Unity to reference the UnityEngine.UI.dll in the [Project]\Library\ScriptAssemblies folder, but I don’t know how to accomplish such a thing.
So my question is as follow: how can I keep the Unity UI package from trying to reference my code?