Created
June 5, 2017 14:02
-
-
Save AVatch/717ae7df2920432aef6113f60671f9af to your computer and use it in GitHub Desktop.
Unity App Manager Singleton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Net; | |
using System.Linq; | |
using UnityEngine; | |
namespace Arlane | |
{ | |
public class AppManager : MonoBehaviour | |
{ | |
public static AppManager instance = null; | |
void Awake() | |
{ | |
if ( instance == null ) | |
{ | |
instance = this; | |
}else if(instance != this) | |
{ | |
Destroy(gameObject); | |
} | |
DontDestroyOnLoad(gameObject); | |
} | |
// Use this for initialization | |
void Start() | |
{ | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment