Skip to content

Instantly share code, notes, and snippets.

@fversnel
Created October 15, 2013 14:13
Show Gist options
  • 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