Skip to content

Instantly share code, notes, and snippets.

@neonm3
Created April 6, 2020 16:34
Show Gist options
  • Save neonm3/7466bbeb52e18cbf03e271333ec4df84 to your computer and use it in GitHub Desktop.
Save neonm3/7466bbeb52e18cbf03e271333ec4df84 to your computer and use it in GitHub Desktop.
Global Manager singleton if necessary
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GM : MonoBehaviour
{
public const int STAGE_ATTRACTOR = 1;
public const int STAGE_HUMAN_DETECTED = 2;
public const int STAGE_BUTTON_INTERACT = 3;
public const int STAGE_POPUP_SHOWN = 4;
public int gameStage;
public XMLStruct config;
public Text debugText;
private static GM _instance;
public static GM inst { get { return _instance; } }
public void Log(string meh)
{
inst.debugText.text += meh + "\n";
}
private void Awake()
{
if (_instance != null && _instance != this)
{
Destroy(this.gameObject);
}
else
{
_instance = this;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment