Skip to content

Instantly share code, notes, and snippets.

@anchan828
Created August 21, 2012 06:46
Show Gist options
  • Save anchan828/3412746 to your computer and use it in GitHub Desktop.
Save anchan828/3412746 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class Example : MonoBehaviour
{
static Example _instance;
void Awake ()
{
if (_instance != null) {
Destroy (gameObject);
} else {
_instance = this;
DontDestroyOnLoad (gameObject);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment