- Home /
Question by
Darkman2345 · Aug 24, 2013 at 08:24 AM ·
audiomusiclanguageoptions
How can i make options scene with music on-off switcher button?
I made options scene but i can't make switcher which switch all the game sounds on-off. Plz anybody help me. And how can i make ingame language switcher?
Comment
Answer by Fr0stbite · Aug 24, 2013 at 09:28 AM
what about with this?
var PlayerCamera: Transform;
private var togglesound: boolean = false;
function Update (){
if(!togglesound){
PlayerCamera.AudioListener.enabled = false;
}
else{
PlayerCamera.AudioListener.enabled = true;
}
}
function OnGUI () {
togglesound = GUI.Toggle(Rect(10, 10, 100, 30),togglesound, "Enable Sounds");
}
Error AudioListener is not member of UnityEngine.Transform
Change this:
function Update (){
if(!togglesound){
PlayerCamera.AudioListene).enabled = false;
}
else{
PlayerCamera.AudioListener.enabled = true;
}
}
with this:
function Update (){
if(!togglesound){
PlayerCamera.GetComponent(AudioListener).enabled = false;
}
else{
PlayerCamera.GetComponent(AudioListener).enabled = true;
}
}
Your answer
Follow this Question
Related Questions
How to STOP music when loading a SPECIFIC SCENE? 3 Answers
Whats the best way to implement different languages? 2 Answers
Why is my backtrack's volume getting lower? 0 Answers
Music Zones play music with tags? 0 Answers
How would I go about using music from StreamingAssets folder (imported by the player) 0 Answers