Creating a UI with UI Toolkit
In this section, we are going to learn about UI documents, a cornerstone of UI Toolkit. These assets are crucial for defining your UI’s structure and components, and we’ll learn how to create and utilize them effectively. To do this, we are going to discuss the following concepts:
- Creating UI Documents
- Editing UI Documents
- Creating UI Stylesheets
Let’s start by seeing how we can create our first UI Document.
Creating UI Documents
When creating a UI with uGUI, we need to create GameObjects and attach components like Button, Image, or Text, but with UI Toolkit, we need to create a UI Document instead. A UI Document is a special kind of asset that will contain the definition of the elements our UI will have and its hierarchy. We will have a GameObject with a UI Document component (yes, it’s called the same, so pay attention here) that will reference this UI Document asset and render its...