예제 #1
0
 public static void CreateInstance()
 {
     Instance = new GameObject(typeof(EditorAudio).Name)
                .AddComponent <EditorAudio>();
     Instance.tag           = "EditorOnly";
     Instance.myAudioSource = Instance.gameObject.GetComponent <AudioSource>();
 }
예제 #2
0
 private void Reset()
 {
     SetDevDescription("I help play audio in the Editor!" +
                       " Make sure I'm tagged 'EditorOnly'.");
     myAudioSource = GetComponent <AudioSource>();
     Instance      = this;
 }
예제 #3
0
    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>();
    }