unity3d 播放音乐

	void Awake(){
		if(player == null){ // try and get it manually if player forgot to assign an AudioSource
			player = GameObject.Find("AudioSource").GetComponent<AudioSource>();
		}
	}
	public AudioClip gameOverSoundFx;

	player.PlayOneShot(<pre name="code" class="html">gameOverSoundFx
);
 
 

你可能感兴趣的:(unity3d 播放音乐)