Indicator on player's head

Options

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.


Answers

  • vadim
    Options

    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.

  • @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
    Options

    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.

  • @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
    Options

    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.

  • @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
    Options

    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.