Version: 5.3 (switch to 5.4b)
언어English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AudioSource.mute

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

닫기

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

닫기

취소

Switch to Manual
public var mute: bool;
public bool mute;

Description

오디오 소스에 대해 Mute기능을 켜고/끕니다. Mute는 음량을 0으로 설정합니다, Un-Mute는 원래 음량을 복원합니다.

	// Mutes-Unmutes the sound from this object each time the user presses space.

function Update() { if(Input.GetKeyDown(KeyCode.Space)) { if(audio.mute) audio.mute = false; else audio.mute = true; } }
	// Mutes-Unmutes the sound from this object each time the user presses space.
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { AudioSource audio; void Start() { audio = GetComponent<AudioSource>(); } void Update() { if (Input.GetKeyDown(KeyCode.Space)) if (audio.mute) audio.mute = false; else audio.mute = true; } }