UI Toolkit - UXML missing xs:sequence

Hi,

i have a custom control that inherits from VisualElement. When i update the uxml schema the ‘xs:sequence’ is missing in the generated xsd type. Because of this i get an error (VSCode Redhat XML Extension) when i add sub controls to my control.

Control:

using UnityEngine.UIElements;

namespace Mogul.Game
{
	[UxmlElement]
	public partial class GameScreenTopBar : VisualElement
	{
		public GameScreenTopBar()
		{
		}
	}
}

UXML:

<?xml version="1.0" encoding="utf-8"?>
<ui:UXML
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:ui="UnityEngine.UIElements"
	xmlns:core="Mogul.UI"
	xmlns:game="Mogul.Game"
	xsi:schemaLocation="UnityEngine.UIElements ../../../../UIElementsSchema/UnityEngine.UIElements.xsd
											Mogul.UI ../../../../UIElementsSchema/Mogul.UI.xsd
											Mogul.Game ../../../../UIElementsSchema/Mogul.Game.xsd"
	editor-extension-mode="False"
>
	<ui:Style src="/Assets/Game/UI/Top/GameScreenTopBar.uss" />
	<game:GameScreenTopBar class="topBar">
		<core:Status name="GoldStatus" icon-image="/Assets/UI/Icons/Gold.png" />
		<ui:VisualElement class="waves">
			<ui:Label text="Wave" class="wavesTitle" />
			<ui:Label name="Waves" text="3 / 13" />
		</ui:VisualElement>
		<ui:Button name="PauseButton" class="icon" icon-image="/Assets/UI/Icons/Pause.png" />
	</game:GameScreenTopBar>
</ui:UXML>

Generated XSD:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:editor="UnityEditor.UIElements" xmlns:engine="UnityEngine.UIElements"
	xmlns="UnityEditor.Accessibility" elementFormDefault="qualified" targetNamespace="Mogul.Game"
	xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:import schemaLocation="UnityEngine.UIElements.xsd" namespace="UnityEngine.UIElements" />
	<xs:complexType name="GameScreenTopBarType">
		<xs:complexContent mixed="false">
			<xs:restriction base="engine:VisualElementType">
				<xs:attribute default="" name="name" type="xs:string" use="optional" />
				<xs:attribute default="true" name="enabled" type="xs:boolean" use="optional" />
				<xs:attribute default="" name="view-data-key" type="xs:string" use="optional" />
				<xs:attribute default="Position" name="picking-mode"
					type="engine:VisualElement_picking-mode_Type" use="optional" />
				<xs:attribute default="" name="tooltip" type="xs:string" use="optional" />
				<xs:attribute default="None" name="usage-hints" type="engine:VisualElement_usage-hints_Type"
					use="optional" />
				<xs:attribute default="0" name="tabindex" type="xs:int" use="optional" />
				<xs:attribute default="false" name="focusable" type="xs:boolean" use="optional" />
				<xs:attribute default="Inherit" name="language-direction"
					type="engine:VisualElement_language-direction_Type" use="optional" />
				<xs:attribute default="" name="data-source" type="xs:string" use="optional" />
				<xs:attribute default="" name="data-source-path" type="xs:string" use="optional" />
				<xs:attribute default="" name="data-source-type" type="xs:string" use="optional" />
				<xs:attribute default="" name="content-container" type="xs:string" use="optional" />
				<xs:attribute default="" name="class" type="xs:string" use="optional" />
				<xs:attribute default="" name="style" type="xs:string" use="optional" />
				<xs:anyAttribute processContents="lax" />
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
	<xs:element name="GameScreenTopBar" substitutionGroup="engine:VisualElement" xmlns:q1="Mogul.Game"
		type="q1:GameScreenTopBarType" />
</xs:schema>

When i copy the ‘xs:sequence’ from the VisualElementType and paste it in the generated xsd everything works fine.

This sounds like a bug. Could you please file a bug report? Unity QA: Building quality with passion

1 Like