Advertisement
evelynshilosky

GlobalState - Part 14

Jun 6th, 2024
70
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.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement