After updateing to UI Toolkit - Latest Version: 1.0.0-preview.6 NO UIElements are rendered in build

I just updated form 2020.1.0 to 2020.1.1 and then updated UIToolkit form from 1.0.0-preview.3 to 1.0.0-preview.6

I didn’t change anything just tried it out.

In editor playmode everything works, but when I make a build (windows x64) i get the following error and non of my UiElements are rendered:

ArgumentNullException: Value cannot be null.
Parameter name: shader
at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
at UnityEngine.Material…ctor (UnityEngine.Shader shader) [0x00008] in C:\buildslave\unity\build\Runtime\Export\Shaders\Shader.bindings.cs:122
at UnityEngine.UIElements.UIR.UIRenderDevice.get_vertexTexturingIsAvailable () [0x0001e] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\Renderer\UIRenderer\UIRenderDevice.cs:236
at UnityEngine.UIElements.UIR.UIRVEShaderInfoAllocator.Construct () [0x000d3] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\Renderer\UIRVEShaderInfoAllocator.cs:232
at UnityEngine.UIElements.UIR.RenderChain.Constructor (UnityEngine.UIElements.IPanel panelObj, UnityEngine.UIElements.UIR.UIRenderDevice deviceObj, UnityEngine.UIElements.UIRAtlasManager atlasMan, UnityEngine.UIElements.UIR.VectorImageManager vectorImageMan) [0x000b6] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\Renderer\UIRChainBuilder.cs:215
at UnityEngine.UIElements.UIR.RenderChain…ctor (UnityEngine.UIElements.IPanel panel) [0x00051] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\Renderer\UIRChainBuilder.cs:188
at UnityEngine.UIElements.UIRRepaintUpdater.CreateRenderChain () [0x00001] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\Renderer\UIRRepaintUpdater.cs:69
at UnityEngine.UIElements.UIRRepaintUpdater.OnPanelChanged (UnityEngine.UIElements.BaseVisualElementPanel obj) [0x00019] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\Renderer\UIRRepaintUpdater.cs:100
at UnityEngine.UIElements.BaseVisualTreeUpdater.set_panel (UnityEngine.UIElements.BaseVisualElementPanel value) [0x00015] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\VisualTreeUpdater.cs:157
at UnityEngine.UIElements.VisualTreeUpdater.SetUpdater[T] (UnityEngine.UIElements.VisualTreeUpdatePhase phase) [0x00019] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\VisualTreeUpdater.cs:115
at UnityEngine.UIElements.VisualTreeUpdater.SetDefaultUpdaters () [0x00031] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\VisualTreeUpdater.cs:132
at UnityEngine.UIElements.VisualTreeUpdater…ctor (UnityEngine.UIElements.BaseVisualElementPanel panel) [0x0001a] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\VisualTreeUpdater.cs:53
at UnityEngine.UIElements.Panel…ctor (UnityEngine.ScriptableObject ownerObject, UnityEngine.UIElements.ContextType contextType, UnityEngine.UIElements.EventDispatcher dispatcher) [0x00060] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\Panel.cs:652
at UnityEngine.UIElements.BaseRuntimePanel…ctor (UnityEngine.ScriptableObject ownerObject, UnityEngine.UIElements.EventDispatcher dispatcher) [0x0001d] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\Panel.cs:900
at UnityEngine.UIElements.RuntimePanel…ctor (UnityEngine.ScriptableObject ownerObject) [0x00000] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\GameObjects\RuntimePanel.cs:17
at UnityEngine.UIElements.RuntimePanel.Create (UnityEngine.ScriptableObject ownerObject) [0x00001] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\GameObjects\RuntimePanel.cs:13
at UnityEngine.UIElements.UIElementsRuntimeUtility.FindOrCreateRuntimePanel (UnityEngine.ScriptableObject ownerObject, UnityEngine.UIElements.UIElementsRuntimeUtility+CreateRuntimePanelDelegate createDelegate) [0x00036] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\Core\UIElementsRuntimeUtility.cs:57
at UnityEngine.UIElements.PanelSettings.CreateRelatedRuntimePanel () [0x00001] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\GameObjects\PanelSettings.cs:357
at UnityEngine.UIElements.PanelSettings.get_m_Panel () [0x00012] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\GameObjects\PanelSettings.cs:251
at UnityEngine.UIElements.PanelSettings.get_visualTree () [0x00000] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\GameObjects\PanelSettings.cs:292
at UnityEngine.UIElements.PanelSettings.AttachAndInsertUIDocumentToVisualTree (UnityEngine.UIElements.UIDocument uiDocument) [0x00009] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\GameObjects\PanelSettings.cs:527
at UnityEngine.UIElements.UIDocument.AddRootVisualElementToTree () [0x00033] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\GameObjects\UIDocument.cs:424
at UnityEngine.UIElements.UIDocument.RecreateUI () [0x000d5] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\GameObjects\UIDocument.cs:346
at UnityEngine.UIElements.UIDocument.OnEnable () [0x00043] in D:\workspaces\DEV SW VIS Unity\LIB SW VIS Unity UP\Library\PackageCache\com.unity.ui@1.0.0-preview.6\GameObjects\UIDocument.cs:174

(Filename: C:/buildslave/unity/build/Runtime/Export/Shaders/Shader.bindings.cs Line: 122)

Hello,

We’ve reproduced this issue once internally and using the Inspector to reset the Panel Settings asset fixed it for us.
If you have data that you don’t want lost and are using “Text Serialization” for assets, ensure the last three fields in the “.asset” files are as follows:

  m_AtlasBlitShader: {fileID: 4800000, guid: 662b00f569c02f84bbc426d4c41ceb5e, type: 3}
  m_RuntimeShader: {fileID: 4800000, guid: 1e5f18a346ed454418f93aa7eaf55791, type: 3}
  m_RuntimeWorldShader: {fileID: 4800000, guid: 7082954141e3ccc43bc3b217cf12e2e0, type: 3}

Let us know if this fixes it for you. We’re not quite sure yet how one can get in this state yet.

Hi,
worked perfectly, many thanks!

Do you know if there is any way to load UIToolkit shaders manually (so they can be accessible in Shade.Find) with asset bundle on 2020.2?

Thank you, this fixed the issue for me. For some reason the serialized asset was missing in the Panel Settings file.

m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
  m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
  m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}

Setting the asset to this code fixed the issue.

m_AtlasBlitShader: {fileID: 4800000, guid: 662b00f569c02f84bbc426d4c41ceb5e, type: 3}
  m_RuntimeShader: {fileID: 4800000, guid: 1e5f18a346ed454418f93aa7eaf55791, type: 3}
  m_RuntimeWorldShader: {fileID: 4800000, guid: 7082954141e3ccc43bc3b217cf12e2e0,
    type: 3}
1 Like