[text] UImanager

Viewer

copydownloadembedprintName: UImanager
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class UiManager : MonoBehaviour
  6. {
  7.  
  8.     [SerializeField] private GameObject cameraUI;
  9.     public static UiManager singleton;
  10.     //awalys there
  11.     private void Awake()
  12.     {
  13.         if (singleton == null)
  14.         {
  15.             singleton = this;
  16.         }
  17.         else
  18.         {
  19.             Destroy(this);
  20.         }
  21.     }
  22.     // Start is called before the first frame update
  23.     public void ToggleCameraUi(bool state)
  24.     {   //bool that controls camera on or off.
  25.         cameraUI.SetActive(state);
  26.     }
  27.  
  28.     void Start()
  29.     {
  30.         
  31.     }
  32.  
  33.     // Update is called once per frame
  34.     void Update()
  35.     {
  36.         
  37.     }
  38. }
  39.  

Editor

You can edit this paste and save as new:


File Description
  • UImanager
  • Paste Code
  • 01 Jul-2022
  • 750 Bytes
You can Share it: