void OnDisable() { if (instance == this) { instance = null; } }
void OnDestroy() { if (instance == this) { instance = null; } }
void OnEnable() { if (instance != null && instance != this) { MonoBehaviour.Destroy(this); Debug.LogError("Only one instance of VoiceChatRecorder can exist"); return; } Application.RequestUserAuthorization(UserAuthorization.Microphone); instance = this; }