public static void CreateInstance() { Instance = new GameObject(typeof(EditorAudio).Name) .AddComponent <EditorAudio>(); Instance.tag = "EditorOnly"; Instance.myAudioSource = Instance.gameObject.GetComponent <AudioSource>(); }
private void Reset() { SetDevDescription("I help play audio in the Editor!" + " Make sure I'm tagged 'EditorOnly'."); myAudioSource = GetComponent <AudioSource>(); Instance = this; }
protected override void Awake() { base.Awake(); #if !UNITY_EDITOR //should be tagged EditorOnly so this doesn't happen. Destroy(this.gameObject); return; #endif Instance = this; myAudioSource = GetComponent <AudioSource>(); }