Placeholder-Software / Dissonance

Unity Voice Chat Asset
69 stars 5 forks source link

tamimzoabi request for help #157

Closed martindevans closed 4 years ago

martindevans commented 4 years ago

@tamimzoabi commented on https://github.com/Placeholder-Software/Dissonance/issues/81#issuecomment-518855507, moving discussion to a new issue.

Hi Please i need your help i need to do the first step of your project : user press a button and start speaking. i configure Dissonance fine . but its start to receive my voice if i press what ever on the scene . i need just to react if i press a Button .

martindevans commented 4 years ago

@tamimzoabi I'm not sure what you are asking, sorry.

Please describe: 1) what you want to happen 2) what you tried 3) what actually happened

So I can help you out :)

tamimzoabi commented 4 years ago

ok firstly i am using unity with pun2 with dissonance last version . my scene is very simple had one button when the button pressed can talk . i do it and its talking but the problem that if i pressed any were on the scene its respond and can talk . i want just by pressing the button to talk . 2: there is too many echo if i talk more than 1 second 3: i build my project and have a one copy run on my pc and second on my phone . with the copy on my pc can talk but with the phone copy cant talk ? thanks a lot for your help .

martindevans commented 4 years ago

It sounds like you have a few different issues to sort out.

i do it and its talking but the problem that if i pressed any were on the scene its respond and can talk . i want just by pressing the button to talk .

I'm not sure what you mean by this, sorry.

It sounds like you want a button you can click with your mouse to start talking? If so, you should have a unity UI element which enables/disables the Dissonance VoiceBroadcastTrigger component and set the VoiceBroadcastTrigger to Voice Activated mode. When the trigger is disabled no voice will be sent, when it is enabled voice will automatically be sent when you talk.

there is too many echo if i talk more than 1 second

There are two settings to help with this.

One is to set Audio Duck Attenuation (docs) to a smaller value (try 0.4). This will reduce the volume of other speakers when you are sending voice, which will reduce echo/feedback.

The other approach is to set up Acoustic Echo Cancellation (docs). This will detect echo and cancel it out automatically.

with the copy on my pc can talk but with the phone copy cant talk

If you're using Push To Talk this is because you are not pressing the "talk" button on the phone. Try setting the VoiceBroadcastTrigger to Voice Activated.

tamimzoabi commented 4 years ago

i am very thank to your help . i had fix the echo and the "phone copy cant talk". but still have problem set the button to activate the triger and DesActivate it . may you please give me a simple code . it may help me a lot please .

martindevans commented 4 years ago

For the button you would need to add a Unity UI element in the editor (e.g. a button).

Create a component like this:

class ToggleVoice
   : MonoBehaviour
{
    public VoiceBroadcastTrigger Trigger;

    public void Toggle()
    {
         Trigger.enabled = !Trigger.enabled;
    }
}

Then set this component in the "OnClick" event of the button to trigger the "Toggle" method.

This is core Unity UI stuff, so if you're not familiar with it there are a lot of excellent video tutorials online to help :)

tamimzoabi commented 4 years ago

thats helped me a lot thanks

martindevans commented 4 years ago

Glad I could help :)

tamimzoabi commented 4 years ago

Hi is there any way to make my apk run under background . i made a chatting rooms .... But photonview && all connection && talking and chatting sound , all that gone if the app is on background . i tried to use Anbdroid Studio and Edit this file "UnityPlayerActivity.java commenting out the calling on the Pause . but it did not work . please ?

martindevans commented 4 years ago

Unfortunately I don't think that's possible with Unity. To have something running in the background you need a service, but you can't make a service with Unity as far as I know.