Search⌘ K
AI Features

User Interface (UI)

Explore how to design and implement user interfaces in Unity using built-in UI components such as buttons, sliders, and toggles. Understand the crucial role of the Canvas and its different render modes including Screen Space Overlay, Screen Space Camera, and World Space, especially for VR development. This lesson helps you create interactive elements that respond to user input and switch scenes, enhancing game interactivity and immersion.

Most user interactions in 2D or 3D games are usually performed with a user interface (UI). The user interface (UI) allows users to interact with the game. In Unity, there are three systems to create a UI. In this section, we’ll look into Unity UI, a built-in UI system to add UI components.

Components in UI

The Unity UI system provides a wide range of components that can be utilized in our projects. Below, we will discuss some of these components and their respective use cases.

  • The Button UI component is commonly used in scenes and comes with a built-in event called onClick, which is triggered when the button is clicked.
  • If we need to display text in our scenes, we can utilize the Text UI component.
  • To obtain binary responses such as yes or no from the user, we can utilize the Toggle component.
  • When we need to gather text input from the user, we can use the Input Field component.
  • The Slider UI component can be used to collect decimal values within a specific range, such as controlling the intensity of a light bulb.
  • The Scrollbar component can be used to toggle between 0 and 1.
Components in UI

Note: Whenever we add any UI component, Canvas comes with it as a default parent component. ...

Rect