Skip to content
HoangVanThu edited this page Jun 24, 2024 · 5 revisions

What

  • The UI screens in the game will be considered as popups.
  • For each popup, there will be a unique prefab and a script inherited from Popup.cs.
  • PopupController has a camera and a canvas. The camera will display the UI elements in the canvas. When entering the game, the popups in PopupConfig will be instantiated in the canvas and can be displayed as needed.
  • The display order of the popup layers will correspond to their arrangement in the config.

Uses

Create new popup

  • You can create new prefab in Canvas Enviroment or copy existent popup prefab, then attach script inherited Popup.cs like image below:

image

  • Add popup to config

image

Show/Hide popup

  • Show popup
PopupController.Instance.Show<PopupInGame>();
  • Hide popup
PopupController.Instance.Hide<PopupInGame>();
  • Hide all popup
PopupController.Instance.HideAll();
  • Get popup
PopupController.Instance.Get<PopupInGame>();
Clone this wiki locally