AudioSource.mute 静音

var mute : bool

Description描述

Un- / Mutes the AudioSource. Mute sets the volume=0, Un-Mute restore the original volume.

是否静音音频源。Mute是设置音量为0,取消静音是恢复原来的音量。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void Update() {

		if (Input.GetKeyDown(KeyCode.Space))

			if (audio.mute)

				audio.mute = false;

			else

				audio.mute = true;



	}

}
// Mutes-Unmutes the sound of this transfor each time the user presses space.

//在每次用户按下空格键,静音开关这个变换的声音



function Update() {

	if(Input.GetKeyDown(KeyCode.Space)) {

		if(audio.mute)

			audio.mute = false;

		else

			audio.mute = true;

	}

}
Page last updated: 2011-4-5