Day 72 — Creating Manager Classes in Unity

private static GameManager _instance;
// This is a property
public static GameManager Instance
{
get
{
if (_instance == null)
{
Debug.LogError("GameManager is null");
}
return _instance;
}
}
// This is an auto-implemented property
public bool HasCard { get; set; }
private void Awake()
{
_instance = this;
}
GameManager.Instance.HasCard = true;
public GameObject winningCutscene;void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
if (GameManager.Instance.HasCard == true)
{
winningCutscene.SetActive(true);
}
else
{
Debug.Log("You must have the KeyCard in hand");
}
}
}

--

--

--

Hey and welcome! My name is Connor and my goal here is to put out a daily post for a full year about my game development journey.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Check if Sentence is Spelled Correctly in Python

Things you should include in a Project Initiation Document (PID)

How to translate English to Russian Text in Python using Deep Learning AI

Checking Clang 11 with PVS-Studio

Leveraging Retrofit Dynamic Url with Paging 3 to create PokemonApp

Git for absolute beginners

How to Convert ODT to JPG in Python

Microsoft Build 2019 Tech Keynote with Exec VP Scott Guthrie

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Connor Fullarton

Connor Fullarton

Hey and welcome! My name is Connor and my goal here is to put out a daily post for a full year about my game development journey.

More from Medium

New Pooling API in Unity 2021

Cinematography in Unity — Working With Audio In Timeline

Creating a triple shot for my Player

How to Put Ads in a Unity Mobile Project