UnityEngine.AudioSource.Play C# (CSharp) Method

Play() private method

private Play ( [ delay ) : void
delay [
return void
        public extern void Play([UnityEngine.Internal.DefaultValue("0")] ulong delay);
        /// <summary>

Same methods

AudioSource::Play ( ) : void

Usage Example

Beispiel #1
0
	void OnLevelWasLoaded(){

		source = GetComponent<AudioSource> ();

		if (GameManager.curScene == "MainMenu") {

			if (source.isPlaying ) {
			
				source.Stop ();
			
			}
			source.clip = songs [0];
			source.Play ();
		
		}else if(GameManager.curScene == "LevelLayout" || GameManager.curScene == "SinglePlayerLevel"){

			//if (source.clip != songs [1]) {
			
			source.Stop ();
			source.clip = songs [Random.Range(1, 3)];
			source.Play ();
			
			//}

		}

	}
All Usage Examples Of UnityEngine.AudioSource::Play