Turn Off Voices?
Turn Off Voices?
Hi!
I wonder if there is a simple way to turn of the voice with a Toggle from my GameManager?
Like, can I talk to the PixelCrusher script somehow and turn off the voice actress if the player don't want it on?
Thanks in advnace!
I wonder if there is a simple way to turn of the voice with a Toggle from my GameManager?
Like, can I talk to the PixelCrusher script somehow and turn off the voice actress if the player don't want it on?
Thanks in advnace!
Re: Turn Off Voices?
Hi,
Yes. The documentation is tucked away in the reference for Audio() and AudioWait(), but to mute those commands set a Dialogue System variable named "Mute" to true:
If you only want to mute voices but not other audio played by Audio() and AudioWait(), assign your actors' Audio Source to a specific audio mixer group (e.g., named "Voices" or something like that). Then set the volume of that audio mixer group to zero.
Yes. The documentation is tucked away in the reference for Audio() and AudioWait(), but to mute those commands set a Dialogue System variable named "Mute" to true:
Code: Select all
// C# code to mute voices:
DialogueLua.SetVariable("Mute", true);
Re: Turn Off Voices?
Thanks.Tony Li wrote: ↑Wed Mar 31, 2021 8:10 am Hi,
Yes. The documentation is tucked away in the reference for Audio() and AudioWait(), but to mute those commands set a Dialogue System variable named "Mute" to true:
If you only want to mute voices but not other audio played by Audio() and AudioWait(), assign your actors' Audio Source to a specific audio mixer group (e.g., named "Voices" or something like that). Then set the volume of that audio mixer group to zero.Code: Select all
// C# code to mute voices: DialogueLua.SetVariable("Mute", true);
Not sure if I follow. I only want to mite the dilaouges I put in the sequence bar inside the conversation. I wonder how/where I write the code.
Code: Select all
// C# code to mute voices:
DialogueLua.SetVariable("Mute", true);
I tried to write
public DialogueLua muteScript; - But it won't find it. Do I have to attach the DialogueLua scripts somewhere first?
I also tried to drag the Dialouge Manager to the Toggle button and find the Mute function that way, but nothing there.
Re: Turn Off Voices?
Hi,
You could add a method like this to your GameManager script:
Note that I flipped the logic: EnableVoiceover(true) turns voices on by setting the Mute variable false, and EnableVoiceover(false) mutes voices by setting the Mute variable true. This way you can hook it up to a UI Toggle's OnValueChanged() event > Dynamic Methods.
You could add a method like this to your GameManager script:
Code: Select all
using PixelCrushers.DialogueSystem; // Add to top of your script.
...
public void EnableVoiceover(bool voicesOn)
{
DialogueLua.SetVariable("Mute", !voicesOn);
}
Re: Turn Off Voices?
Tony Li wrote: ↑Fri Apr 02, 2021 8:33 am Hi,
You could add a method like this to your GameManager script:
Note that I flipped the logic: EnableVoiceover(true) turns voices on by setting the Mute variable false, and EnableVoiceover(false) mutes voices by setting the Mute variable true. This way you can hook it up to a UI Toggle's OnValueChanged() event > Dynamic Methods.Code: Select all
using PixelCrushers.DialogueSystem; // Add to top of your script. ... public void EnableVoiceover(bool voicesOn) { DialogueLua.SetVariable("Mute", !voicesOn); }
thank you soo much!
I couldn't make it work with toggle (In the game manger all toggle stuff had a Error line underneath them) so I moved it to the audio script and it worked. But I just can't wrap my head around the double negative way of writing scripts. .Like "if !on = on" so I couldn't make it work with the toggle. I managed to turn off the sound but not turn it back on. I tried a few variations on how to set up the toggle but.... No luck - However!
It works with using two buttons and I made them look neat, so Im happy with this! I just made two functions inside my Audio Script:
public void EnableVoiceover(bool voicesOn)
{
DialogueLua.SetVariable("Mute", !voicesOn);
Debug.Log("Sound ON");
}
public void EnableOffVoiceover(bool voicesOn)
{
DialogueLua.SetVariable("Mute", voicesOn);
Debug.Log("Sound OFF");
}
Like that...
Thanks for the help!
Re: Turn Off Voices?
Hi,
Great! You could probably simplify it even more:
Great! You could probably simplify it even more:
Code: Select all
public void EnableVoiceover()
{
DialogueLua.SetVariable("Mute", true);
Debug.Log("Sound ON");
}
public void EnableOffVoiceover()
{
DialogueLua.SetVariable("Mute", false);
Debug.Log("Sound OFF");
}
Re: Turn Off Voices?
Thanks! Will try that.Tony Li wrote: ↑Fri Apr 02, 2021 9:41 am Hi,
Great! You could probably simplify it even more:
Code: Select all
public void EnableVoiceover() { DialogueLua.SetVariable("Mute", true); Debug.Log("Sound ON"); } public void EnableOffVoiceover() { DialogueLua.SetVariable("Mute", false); Debug.Log("Sound OFF"); }
Btw, its working but in my audio script the using PixelCrushers.DialogueSystem; is underlined with a Red Error Line.
Also, the the public void function the word "DialogueLua" has a red Error line... ANy idea why that is?
It sais "CS0103: The name "DialogeLua" does not exist in the current context.