Advertisement
evelynshilosky

GlobalState - Part 31

Feb 2nd, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GlobalState : MonoBehaviour
  6. {
  7.     public static GlobalState Instance { get; set; }
  8.  
  9.     public float resourceHealth;
  10.     public float resourceMaxHealth;
  11.  
  12.  
  13.     private void Awake()
  14.     {
  15.         if (Instance != null && Instance != this)
  16.         {
  17.  
  18.             Destroy(gameObject);
  19.  
  20.         }
  21.         else
  22.         {
  23.             Instance = this;
  24.         }
  25.     }
  26.  
  27.  
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement