Skip to content

Instantly share code, notes, and snippets.

@fversnel
Created October 15, 2013 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fversnel/6992212 to your computer and use it in GitHub Desktop.
Save fversnel/6992212 to your computer and use it in GitHub Desktop.
Singleton implementation from the 'Unite 2013 - Internal Unity Tips and Tricks' talk (http://www.youtube.com/watch?v=Ozc_hXzp_KU)
using UnityEngine;
public class Example : MonoBehaviour
{
public static Example Singleton;
void OnEnable()
{
if (Singleton == null)
Singleton = this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment