Indicator on player's head

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Voice.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Indicator on player's head

justalildeveloper
2022-10-21 08:34:40

Hey everyone,

I am trying to know who is talking on server and have a indicator game object on my player prefab. I want it to show up when player is talking but it shows up locally (the player's ingame does not sees it)

Can you guys help? Thanks.

Comments

vadim
2022-10-24 08:37:25

For remote voices, you need to check PhotonVoiceView.IsSpeaking, not IsRecording.

Don't call expensive GetComponent in Update and don't use RPC. Instead, find PhotonVoiceView instance in Awake and use it for IsSpeaking check in Update(). See Highlighter.cs in DemoVoicePun project.

justalildeveloper
2022-10-24 08:55:37

@vadim Thanks for advices. All good now but when I talk, everyone's indicator except me is getting active. Only the one who talks is not getting active. Do you have any advices for this?

vadim
2022-10-25 07:26:19

Did you follow Highlighter.cs sample? Does this sample work correctly for you? I think, you just made a small mistake like searching for the wrong object in Awake. Check you code carefully.

justalildeveloper
2022-10-31 14:05:47

@vadim Yes I followed it but it doesn't work for me. Where should I add this script, to my character or on an item on my scene?

vadim
2022-11-01 08:45:14

So it works in Voice PUN demo but not in you project?

In the demo, the script is attached to the character prefab. The script has 2 properties which must be set In the Editor to images that are parts of the prefab and represent recording and speaking states.

justalildeveloper
2022-11-03 08:27:30

@vadim When I try to build and test Voice PUN Demo it happens same. When I try to talk on a build, every build sees it like its the one talking. Does the script capture the mic independent for builds? I mean if I try it on same computer, I can't test it right?

vadim
2022-11-07 10:06:31

When several app instances run on the same compuer, the mic is shared between them and every instance can capture and broadcast the same mic input. Start recording on one instance only to highlight the recorder on this instance and all corresponding speakers on other instances.

Back to top