User Interface (UI)

Build on the fundamentals of Unity by learning about the user interface (UI).

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