UploadService uploadService; // Initialising Upload Service. #endregion Fields #region Methods public static Upload_Main GetInstance() { if (con == null) { con = (new GameObject ("Upload_Main")).AddComponent<Upload_Main> (); return con; } else { return con; } }
void Awake() { // First we check if there are any other instances conflicting if (con != null && con != this) { // If that is the case, we destroy other instances Destroy (gameObject); } // Here we save our singleton instance con = this; // Furthermore we make sure that we don't destroy between scenes (this is optional) DontDestroyOnLoad (gameObject); }