VoiceChat
Jump To Parameters
Jump To Function Definitions
Parameter Definitions
Select the parameter name from below to jump directly to it on this page.
buttonToPress
connectionStatus
debugging
ifOnTeam
isPlayer
pushToTalk
recordingImage
speakerImage
buttonToPress
Button press to enable voice transmittion.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | string | None |
connectionStatus
Hidden variable. Shows the current voice connection status as an easy to reference string.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | string | ”” |
debugging
Verbose console logging to help you while you debug.
| Exposed Value | Type | Default Value |
|---|---|---|
| private | bool | false |
ifOnTeam
Will only enable the voice chat indicator if you’re on the target team. “
If left blank will always enable when talking across the network, no matter “
what team your on.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | string | ”” |
isPlayer
This component is for the player or not.
| Exposed Value | Type | Default Value |
|---|---|---|
| private | bool | false |
pushToTalk
Automatically record voice when speaking or require a button to be pushed.
| Exposed Value | Type | Default Value |
|---|---|---|
| private | bool | false |
recordingImage
The image to show when you are recording your voice
| Exposed Value | Type | Default Value |
|---|---|---|
| public | GameObject | null |
speakerImage
The image to show when voice is being played through the speaker.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | GameObject | null |
Function Definitions
Select the function name from below to jump directly to it on this page.
Awake
CalibrateVoiceDetector
ConnectToVoiceServer
DisconnectFromVoiceServer
EnableEncryptedAudioStream
EnableLoopAudioPlayback
EnableMuteSpeaker
EnablePushToTalk
EnableRecorderReliableMode
EnableTransmitVoice
EnableVoiceDetection
EnableVoiceEcho
GetCurrentMicrophone
GetIntresetGroup
InitializeRecorder
RecorderIsRecording
RecorderIsTransmitting
SetIntrestGroup
SetMicrophoneDevice
SetSpeakerPrefab
Start
StartRecording
Update
VoiceClientStateChanged
public virtual void Awake()
Immediately turns off the is speaking and is recording images.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void CalibrateVoiceDetector(int howLong)
Initializes the record if not already initalized. Call this to set the
PrimaryRecorderinto calibration mode and for how long.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| howLong | int type, how long to wait until calibration is completed. |
public virtual void ConnectToVoiceServer()
Will connect to the voice chat server.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void DisconnectFromVoiceServer()
Will disconnect from the voice chat server.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void EnableEncryptedAudioStream(bool enabled)
Enable encryption of audio streams. Heavier on network traffic but more secure (if worried about that sort of thing).
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, encrypt audio traffic? |
public virtual void EnableLoopAudioPlayback(bool enabled)
Will loop the voice on play back or not.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, you want the played voice to continue looping? |
public virtual void EnableMuteSpeaker(bool enabled)
Will turn the audio source volume to zero or back to it’s
originalAudioVolumeparameter setting based on the input value that you pass in.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, mute audio source or not? |
public virtual void EnablePushToTalk(bool enabled)
Will immediately stop recording and set the Push-To-Talk value to whatever you pass in.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, enable Push-To-Talk or not? |
public virtual void EnableRecorderReliableMode(bool enabled)
Set the
PrimaryRecorderto be inReliableModeor not. Read more about this on the photon documentation here: https://doc.photonengine.com/en-us/voice/current/getting-started/recorder
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, make the recorder reliable or not |
public virtual void EnableTransmitVoice(bool enabled)
Allow the
PrimaryRecorderto send the recorded voice over the network or not
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, send voice over network? |
public virtual void EnableVoiceDetection(bool enabled)
Will initialize the recorder if not. Will set the
PrimaryRecorderto filter recorded sound and transmit only when a predefined threshold of signal level is exceeded. Read more about voice detection here: https://doc.photonengine.com/en-us/voice/current/getting-started/recorder
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, enable Voice detection? |
public virtual void EnableVoiceEcho(bool enabled)
Play your recorded voice locally. Excellent for debugging purposes.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, enable voice playback? |
public virtual string GetCurrentMicrophone()
Get a list of detected microphone devices Get the current actively used microphone.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | A list of detected mics Current active mic |
No parameters
public virtual byte GetIntresetGroup()
The current voice group to listen and receive transmissions from. (0 means everyone.) Read more about this here: https://doc.photonengine.com/en-us/voice/current/getting-started/recorder
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Your current group |
No parameters
public virtual void InitializeRecorder()
Performs initializations on the recorder. Read more from the getting started guide in photon: https://doc.photonengine.com/en-US/voice/current/getting-started/voice-for-pun
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual bool RecorderIsRecording()
Returns true or false if the
PrimaryRecorderis recording voice or not.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | True of False, is recording right now? |
No parameters
public virtual bool RecorderIsTransmitting()
Returns true or false if the
PrimaryRecorderis currently transmitting the recorded voice over the network or not.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True |
No parameters
public virtual void SetIntrestGroup(byte group)
Set what group you would like to receive transmissions from. (0 means everyone.) Read more about this here: https://doc.photonengine.com/en-us/voice/current/getting-started/recorder
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| group | byte type, the group to listen to |
public virtual void SetMicrophoneDevice(string deviceName)
Set the active microphone device to be whatever you pass in. The name must match what is currently known. Can call
GetAllMicrophoneDevicesto know what is currently known.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| deviceName | string type, the name of the microphone device to set your active device to |
public virtual void SetSpeakerPrefab(GameObject target)
Sets the target of the
SpeakerPrefab. Read the photon documentation for more about this: https://doc.photonengine.com/en-US/voice/current/getting-started/voice-for-pun
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| target | The GameObject to set as the SpeakerPrefab |
public virtual void Start()
Enables/Disables recording based on the settings in this component.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void StartRecording(bool enabled)
Makes the
PrimaryRecorderstart recording or not.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, start recording voice or not |
protected virtual void Update()
Will record based on inputs or record based on voice levels. This is all based on the settings on this component.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
protected virtual void VoiceClientStateChanged(Photon.Realtime.ClientState fromState, Photon.Realtime.ClientState toState)
Callback method. Called whenever the state of the voice client changes. This is used to set the
connectionStatusstatus variable.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| fromState | Photon.Realtime.ClientState type, the state you were in |
| toState | Photon.Realtime.ClientState type, the state your now in |