Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SingletonBehaviour<T> : MonoBehaviour where T : MonoBehaviour
- {
- private static T instance;
- public static T Instance
- {
- get
- {
- if (instance == null)
- instance = FindObjectOfType<T>();
- return instance;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement