Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Global : MonoBehaviour
- {
- private static Global instance;
- void Awake()
- {
- if (!instance)
- {
- instance = this;
- DontDestroyOnLoad(gameObject);
- InitFirst();
- }
- else
- {
- Destroy(gameObject);
- }
- }
- void Start()
- {
- InitScene();
- }
- void OnLevelWasLoaded()
- {
- InitScene();
- }
- void InitFirst()
- {
- // ...
- }
- void InitScene()
- {
- // ...
- }
- // public static functions here:
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement