Navigation Struct conflicts with Namespace

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?

There is probably a new namespace called “Navigation” from the new version of unity you updated.

If the “Navigation” enum was from your script then…
…I would advise to go back to the old version project, and then to rename your Navigation enum to something like NavigationPlayer.

Run again with the new Unity and it should be fine.

I think you interpreted my post the wrong way around. The Navigation Enum is part of the Unity UI package, and lives in the UnityEngine.UI namespace. The Navigation Namespace was introduced by me by the libraries I use.

It is not possible for me to change either.

Then rather than calling Navigation only you can call it by it’s full namespace : UnityEngine.UI.Navigation, the same for the third party library you are using. That help the program to make the different between the 2 Navigation call.

I understand that. But the calls are in the Unity UI package, which is a Unity package. I don’t call the Navigation Enum from my own code at any point.