After upgrading from preview-14 to preview-16 (which by the looks of it upgrades com.unity.textcore from preview-2 to -3) on Unity 2020.3.1f1.59.4 I start getting 3 errors in the textcore package,.:
Library\PackageCache\com.unity.textcore@1.0.0-preview.3\Scripts\Runtime\FontAsset.cs(481,28): error CS0117: ‘FontEngine’ does not contain a definition for ‘TryGetSystemFontReference’
Library\PackageCache\com.unity.textcore@1.0.0-preview.3\Scripts\Runtime\FontAsset.cs(481,81): error CS0246: The type or namespace name ‘FontReference’ could not be found (are you missing a using directive or an assembly reference?)
Library\PackageCache\com.unity.textcore@1.0.0-preview.3\Scripts\Runtime\FontAsset.cs(985,67): error CS1503: Argument 2: cannot convert from ‘string’ to ‘int’
I found people online mentioning this error in context of TextMeshPro package, but upgrading/removing that package doesn’t do anything. Neither does nuking package cache…
Hello! This sounds like you’re maybe on an older version of Unity that is not compatible with the most recent versions of the packages. What version are you on? And can you update that?
Is there a compat table somewhere? I installed 2020.3.18f1 and after a lot of struggle (including deleting Library, resetting packages to defaults, etc.) I finally was able to get preview-16 to work.
However, by default 2020.3.18f install preview-17 (when you first click install that is what you get), and that one doesn’t seem to work - even though the project builds in VS, Unity complains that UIToolkit classes do not exist and refuses to launch… Console is also full of random internal errors like:
Should not grab hot control with an active capture
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Should not be capturing when there is a hotcontrol
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Trying to read value of type Color while reading a value of type Function
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
After opening UI builder (despite the fact that it seems to work)
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UIElements.UIDocument.DisableCompanions () (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/GameObjects/UIDocument.cs:649)
UnityEngine.UIElements.UIDocument.HandleLiveReload () (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/GameObjects/UIDocument.cs:623)
UnityEditor.UIElements.UIDocumentVisualTreeAssetTracker.OnVisualTreeAssetChanged () (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Editor/GameObjects/LiveReloadTrackerCreator.cs:43)
UnityEngine.UIElements.BaseLiveReloadVisualTreeAssetTracker.OnTrackedAssetChanged () (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/BaseLiveReloadAssetTracker.cs:159)
UnityEngine.UIElements.VisualTreeAssetChangeTrackerUpdater.Update () (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/VisualTreeAssetChangeTrackerUpdater.cs:216)
UnityEngine.UIElements.VisualTreeUpdater.UpdateEditorVisualTreePhase (UnityEngine.UIElements.VisualTreeEditorUpdatePhase phase) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/VisualTreeUpdater.cs:143)
UnityEngine.UIElements.Panel.UpdateAssetTrackers () (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/Panel.cs:927)
UnityEngine.UIElements.BaseVisualElementPanel.Update () (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/Panel.cs:544)
UnityEngine.UIElements.RuntimePanel.Update () (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/GameObjects/RuntimePanel.cs:47)
UnityEngine.UIElements.UIElementsRuntimeUtility.UpdateRuntimePanels () (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/UIElementsRuntimeUtility.cs:209)
UnityEngine.UIElements.UIElementsRuntimeUtilityNative.UpdateRuntimePanels () (at <e6eb0f9e27a44a61bc4b3bc896556eb7>:0)
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateToIMGUIContainer (UnityEngine.UIElements.VisualElement root, UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/Events/IEventDispatchingStrategy.cs:198)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToIMGUIContainer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/Events/MouseEventDispatchingStrategy.cs:56)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/Events/MouseEventDispatchingStrategy.cs:26)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/Events/MouseEventDispatchingStrategy.cs:19)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/EventDispatcher.cs:381)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/EventDispatcher.cs:344)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/EventDispatcher.cs:222)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/Panel.cs:383)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/UIElementsUtility.cs:466)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/UIElementsUtility.cs:209)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/UIElementsUtility.cs:74)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at Library/PackageCache/com.unity.ui@1.0.0-preview.17/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <00a477ed1abf4030be646c3244bd3667>:0)
EDIT: it appears my message above is awaiting moderation, but this one isn’t. The above message has the new callstacks.
Ok scratch that, after closing and reopening unity without changing anything I get the above errors on preview-16, and the project also no longer builds in Unity because UIDocument/VisualElement/etc. are not found (VS still builds just fine and UI Builder works).
Btw package manager also breaks during package updates and requires reopening/resetting/…
This is really messed up.
Unity, package manager, the new UI package, and my project appear to have some sort of crazy inter-dependencies where changing any one of them can break any other up and down the stack, including internals.
Perhaps package management should be decoupled from projects? This is totally broken. I want to have an install of Unity that “just works”, then open my project that “just worked” before, and the only new issues should be on the API level between them (e.g. function signature change or whatever). Gamedev is just a hobby for me but I do backend for “big data” at my job and did a bunch of webdev before, I wrote some ATM sofware, etc… this is how package management (and IDEs for that matter) work in any sane development environment. How this stuff is possible just boggles my mind…
When we publish new versions, we include in the Forum announcement posts (for UI Toolkit and UI Builder ) what are the compatible versions, but there’s no compiled table that I know of.
About the errors you’re seeing, it’s hard to tell without looking at your project, but I suspect that may be some unrecognized component on the same Game Object where you have your UIDocument - can you check that all your components are ok?
We test and make sure the Package Manager works with the versions of UI Toolkit we publish, but if you have a situation in which it’s breaking you probably found a bug and we’d need to check! You can report bugs through Unity on Help > Report a Bug