AudioSource
.mute
Manual
Reference
Scripting
Scripting
>
Runtime Classes
>
AudioSource
AudioSource
.mute
Menu
Overview
Runtime Classes
Attributes
Enumerations
Editor Classes
Enumerations
History
Index
AudioSource
All Members
Variables
bypassEffects
clip
dopplerLevel
ignoreListenerVolume
isPlaying
loop
maxDistance
minDistance
mute
pan
panLevel
pitch
playOnAwake
priority
rolloffMode
spread
time
timeSamples
velocityUpdateMode
volume
Functions
GetOutputData
GetSpectrumData
Pause
Play
PlayOneShot
Stop
Class Functions
PlayClipAtPoint
Inherited Variables
animation
audio
camera
collider
constantForce
enabled
gameObject
guiText
guiTexture
hideFlags
hingeJoint
light
name
networkView
particleEmitter
renderer
rigidbody
tag
transform
Inherited Functions
BroadcastMessage
CompareTag
GetComponent
GetComponent.<T>
GetComponentInChildren
GetComponentInChildren.<T>
GetComponents
GetComponents.<T>
GetComponentsInChildren
GetComponentsInChildren.<T>
GetInstanceID
SendMessage
SendMessageUpwards
ToString
Inherited Class Functions
Destroy
DestroyImmediate
DontDestroyOnLoad
FindObjectOfType
FindObjectsOfType
Instantiate
Instantiate.<T>
operator !=
operator ==
operator bool
var
mute :
bool
Description
Un- / Mutes the AudioSource. Mute sets the volume=0, Un-Mute restore the original volume.
JavaScripts
JavaScript
C#
Boo
// 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;
}
}
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;
}
}
import
UnityEngine
import
System.Collections
class
example(
MonoBehaviour
):
def
Update
():
if
Input.GetKeyDown
(
KeyCode.Space
):
if
audio.mute:
audio.mute =
false
else
:
audio.mute = true