ChatBox
Jump To Parameters
Jump To Delegates
Jump To Function Definitions
Parameter Definitions
Select the parameter name from below to jump directly to it on this page.
ChatDisabled
ChatEnabled
OnReceiveBroadcastMessage
OnUserSubscribedToDataChannel
OnUserUnSubscribedToDataChannel
OnYouSubscribeToAnyChannel
OnYouSubscribeToDataChannel
OnYouUnSubscribeFromAnyChannel
OnYouUnSubscribeToDataChannel
ReceivedAnyChatMessage
ReceivedOtherPlayerChatMessage
authType
autoScroll
chatAnim
chatChannel
chatNotification
closeWindowOnPress
connectionStatus
enableOnConnect
messagesObj
msgInput
newMessageIcon
nm
notificationVolume
onlyWhenWindowClose
openChatWindowOnPress
otherChatMessage
parentChatObj
protocol
region
scrollRect
sendChatOnPress
slideIn
slideOut
source
startEnabled
yourChatMessage
ChatDisabled
UnityEvent. Called when you disable the chatbox.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | UnityEvent | None |
ChatEnabled
UnityEvent. Called when you enable the chatbox.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | UnityEvent | None |
OnReceiveBroadcastMessage
UnityEvent. Called when you receive a Broadcast data message type.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | BroadCastUnityEvent | None |
OnUserSubscribedToDataChannel
UnityEvent. Called when another player subscribes to the data chat channel.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | StringUnityEvent | None |
OnUserUnSubscribedToDataChannel
UnityEvent. Called when another player un-subscribes from the data chat channel.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | StringUnityEvent | None |
OnYouSubscribeToAnyChannel
UnityEvent. Called when YOU as the owner subscribe to a any new chat channel.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | StringUnityEvent | None |
OnYouSubscribeToDataChannel
UnityEvent. Called when YOU as the owner subscribe to the data chat channel.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | UnityEvent | None |
OnYouUnSubscribeFromAnyChannel
UnityEvent. Called when YOU as the owner un-subscribe from any chat channel.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | StringUnityEvent | None |
OnYouUnSubscribeToDataChannel
UnityEvent. Called when YOU as the owner un-subscribe from the data chat channel.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | UnityEvent | None |
ReceivedAnyChatMessage
UnityEvent. Called whenever ANY chat message is received.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | SentChatUnityEvent | None |
ReceivedOtherPlayerChatMessage
UnityEvent. Called whenver you receive a chat message from someone else.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | SentChatUnityEvent | None |
authType
What type of authenication you want to use with this chat.
| Exposed Value | Type | Default Value |
|---|---|---|
| None | CustomAuthenticationType | Photon.Chat.CustomAuthenticationType.None |
autoScroll
Whether or not you want to automatically scroll to the bottom when a new message comes in.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | bool | true |
chatAnim
The animator that controls the slide in/out actions of the chatbox.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | Animator | null |
chatChannel
The default channel to subscribe to if you don’t set the channel in other ways.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | string | “worldChat” |
chatNotification
The notification sound you want to play
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | AudioClip | null |
closeWindowOnPress
The buttons that are responsible for closing the chat window
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | List |
new List |
connectionStatus
The text element that will display the connection status.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | Text | null |
enableOnConnect
When successfully connected display the chatbox.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | bool | true |
messagesObj
The object that will hold all the generate message objects.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | GameObject | null |
msgInput
The input field where you can type a chat message.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | InputField | null |
newMessageIcon
The icon that will appear when a new message is recieved.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | GameObject | null |
nm
The network manager to reference. This will be things like the game version.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | NetworkManager | null |
notificationVolume
How loud you want to play the notification sound.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | float | 0.5f |
onlyWhenWindowClose
Only display the new message icon when the chat window is closed.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | bool | true |
openChatWindowOnPress
The buttons that are responsible for opening the chat window
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | List |
new List |
otherChatMessage
The gameobject holding the "ChatMessage" component that will be generated when someone else sends you a message.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | GameObject | null |
parentChatObj
The object that holds everything for your chat UI.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | GameObject | null |
protocol
The protocol to use for your chat client
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | ConnectionProtocol | ConnectionProtocol.Udp |
region
The region you want to have this chat client be in.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | PhotonChatRegions | PhotonChatRegions.US |
scrollRect
The scroll rect that controls the scrolling of the chatbox.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | ScrollRect | null |
sendChatOnPress
Send your message on this keyboard press.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | List |
new List |
slideIn
The name of the animation to play when the chat box is enabled. If you have a chatAnim component supplied.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | string | “Slide_In” |
slideOut
The name of the animation to play when the chat box is disabled. If you have a chatAnim component supplied.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | string | “Slide_Out” |
source
Where the sound clip will play from.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | AudioSource | null |
startEnabled
Start with the chatbox out and selected.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | bool | false |
yourChatMessage
The gameobject holding the "ChatMessage" component that will be generated when you send a message.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | GameObject | null |
Delegate Definitions
Select the delegate name from below to jump directly to it on this page.
OnConnectedToChat
OnHideChatBox
OnRecieveData
OnRecieveMessage
OnShowChatBox
OnSubscribedToChannles
OnUnSubscribedFromChannels
OnUserSubToChannel
OnUserUnSubFromChannel
public BasicDelegate OnConnectedToChat
Called when you have successfully connected to the chat server.
No parameters
public BasicDelegate OnHideChatBox
Called when you hide/slide out the chatbox.
No parameters
public ChatDataMessage OnRecieveData
Called when you receive a data message in the chat.
| Parameter Name | Description |
|---|---|
| type | System.Type type, The system type of this serialized data. |
| incomingData | string type, Serialized dictionary data to be parsed by the data channel. |
public SentChatMessageDelegate OnRecieveMessage
Called when you receive a any message, data or chat.
| Parameter Name | Description |
|---|---|
| message | string type, SentChatMessage type which consists of the player name and the message. |
public BasicDelegate OnShowChatBox
Called when you show/slide in the chatbox.
No parameters
public ChatSubChannels OnSubscribedToChannles
Called when you unsubscribe from any channel.
| Parameter Name | Description |
|---|---|
| channels | string[] type, The chat channels that you want to subscribe to |
| results | bool[] type, If subscription was successful or not. |
public ChatChannels OnUnSubscribedFromChannels
Called when you subscribe to any channel.
| Parameter Name | Description |
|---|---|
| channels | string[] type, the channels that you have unsubscribed from |
public ChatUserChannel OnUserSubToChannel
Called when another user subscribes to any channel you’re in.
| Parameter Name | Description |
|---|---|
| channel | string type, the channel the user has subscribe to |
| user | string type, the user that has subscribed |
public ChatUserChannel OnUserUnSubFromChannel
Delegate. Called when another user un-subscribes to any channel you’re in.
| Parameter Name | Description |
|---|---|
| channel | string type, the channel the user has subscribe to |
| user | string type, the user that has subscribed |
Function Definitions
Select the function name from below to jump directly to it on this page.
AutoScrollToBottom
Awake
BroadcastData
Connect
DebugReturn
Disconnect
Disconnect
DisplayNewChatIcon
EnableChat
EnableVisualBox
FindPlayerCam
GetUserId
IsConnectedToDataChannel
IsDictionary
IsEnabled
IsPressingButton
OnApplicationQuit
OnChatStateChange
OnConnected
OnDestroy
OnDisconnected
OnGetMessages
OnPrivateMessage
OnStatusUpdate
OnSubscribed
OnUnsubscribed
OnUserSubscribed
OnUserUnsubscribed
PlayChatNotificationSound
ReceiveData
ReceiveNewMessage
SceneLoaded
SendMessage
SetActiveChannel
SetActiveRoomAsChannelName
SetMyPlayer
Start
SubscribeToChannel
UnSubscribeToChannel
Update
public virtual void AutoScrollToBottom()
Make the scroll view of the chatbox scroll to the bottom.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
protected virtual void Awake()
Used to unlock the mouse and make the mouse cursor visible. Also generates your players unique hash for the chat. Finally makes sure the chat icon is turned off.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
public virtual void BroadcastData(string channelName, object data)
Call this function to send data to a channel name to every player subscribed to that channel. Call ‘BuildDataObj’ function to format and build the serialized data string to send.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| channelName | string type, The name of the channel to send data over, must be subscribed to it. |
| data | object type, the data to send in the channelName |
public virtual void Connect()
Connect to the chat server.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void DebugReturn(DebugLevel level, string message)
For debugging purposes only. Used to debug information
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| level | DebugLevel type |
| message | string type, the message that was recieved |
public virtual void Disconnect(string placeholder = “”)
Disconnect from the chat server. This is only used in scenarios with things that need a string input. Simply calls the Disconnect() function.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| placeholder | Empty placeholder, does nothing. |
public virtual void Disconnect()
Disconnect from the chat server.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void DisplayNewChatIcon(bool enabled)
Enable or disable the chat icon.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | bool type, true = on/enabled |
public virtual void EnableChat(bool enabled)
Enable/Disable the chatbox, Lock/Unlock the mouse, Hide/Show the mouse, Lock/Unlock camera movement, slide in/slide out the chatbox and selects/ deselects the inputfield.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | *No found decription |
public virtual void EnableVisualBox(bool enabled)
Hide/Show the actual chatbox (not sliding in or out), actually enable of disable the object itself.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| enabled | *No found decription |
protected virtual void FindPlayerCam()
Find the camera that you use to look around with your player.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
public virtual string GetUserId()
Returns your unique userid for the chatbox
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | your unique user id |
No parameters
public virtual bool IsConnectedToDataChannel()
Returns the subscribers of this channel. Returns true or false if you’re currently subscribed to the data channel.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | list of users currently subscribed to this channel |
| Parameter Name | Description |
|---|---|
| channel | string type, the channel name |
public virtual bool IsDictionary(object o)
Internal used function, true or false if the passed in object is a dictionary or not. Used as part of the data channel parsing.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | true if dictionary, false if not |
| Parameter Name | Description |
|---|---|
| o | object type, the object to check |
public virtual bool IsEnabled()
Returns true or false if the chatbox is active
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | True or False, The chatbox is active? |
No parameters
private bool IsPressingButton(List codes)
Returns true if pressing one of the passed in button names.
| Expose Value | Overrideable | Returns |
|---|---|---|
| private | False | true if pressing any one of these passed in button codes |
| Parameter Name | Description |
|---|---|
| codes | List of strings type, The button codes to check |
public virtual void OnApplicationQuit()
To avoid that the Editor becomes unresponsive, disconnect all Photon connections in OnApplicationQuit.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void OnChatStateChange(ChatState state)
Callback method. Called whenever your connection status changes
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| state | ChatState type, the current connection state |
public virtual void OnConnected()
Callback method. Called when you are connected to the chat server
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void OnDestroy()
To avoid that the Editor becoming unresponsive, disconnect all Photon connections in OnDestroy.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void OnDisconnected()
Callback method. Called when you get disconnected from the chat server
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void OnGetMessages(string channelName, string[] senders, object[] messages)
Callback method. Called whenever you receive a new message on ANY subscribed channel
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| channelName | string type, The channel name that is receiving the message |
| senders | string type, Who is sending the message |
| messages | string type, The actual string message |
public virtual void OnPrivateMessage(string sender, object message, string channelName)
Callback method. Called whenever you receive a private message
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| sender | string type, Who is sending the mesage |
| message | string type, The actual message |
| channelName | string type, The channel name receiving the message |
public virtual void OnStatusUpdate(string user, int status, bool gotMessage, object message)
Callback method. Called when a user’s status has updated.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| user | string type, the user that updated |
| status | int type, the users current status |
| gotMessage | bool type, recieved the message |
| message | object type, the messsage that was sent |
public virtual void OnSubscribed(string[] channels, bool[] results)
Callback method. Called when you subscribed to a channel.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| channels | Array type, All the channels you tried subscribed to |
| results | Array type, the success or failure of this subscription |
public virtual void OnUnsubscribed(string[] channels)
Callback method. Called when you unsubscribe from a channel
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| channels | Array type, channel that were un-subscribed from |
public virtual void OnUserSubscribed(string channel, string user)
Callback method. Called when another user subscribes to a channel.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| channel | string type, the channel that was subscribed to |
| user | string type, the user that subscribed |
public virtual void OnUserUnsubscribed(string channel, string user)
Callback method. Called when another user un-subscribes from a channel.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| channel | string type, the channel that was unsubscribed from |
| user | string type, the user that unsubscribed |
public virtual void PlayChatNotificationSound()
Play the notification sound from the specific sound source in the parameters.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void ReceiveData(Type type, string incomingData)
Use to receive serialized data convert it back to its original type and call an action based on the type of data that was recieved.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| type | System.Type type, The type of data object this is |
| incomingData | string type, The serialized data |
public virtual void ReceiveNewMessage(SentChatMessage incoming)
Receive a message that was sent by another player and instantiate a new line in the chatbox with this information. Then trigger to display the chat icon.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| incoming | SentChatMessage type, consists of a player name and the message |
protected virtual void SceneLoaded(Scene scene, LoadSceneMode mode)
Callback method. Called when a scene has successfully loaded. This will call ‘FindPlayerCam’ function.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| scene | Scene type |
| mode | LoadSceneMode type |
public virtual void SendMessage(string channelName, string message)
Take an object and return a serialized version of it to send in data chatbox channels. Send a string message to a channel name that you’re already subscribed to.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Serialized data that is compatible with the chatbox’s data channel |
| Parameter Name | Description |
|---|---|
| data | object type, the data you want to serialize |
| channelName | string type, the channel name you want to send a message to. |
| message | string type, the actual message to send. |
public virtual void SetActiveChannel(string newChannel)
Returns a list of all the channel names that you’re subscribed to Un-subscribe from the previous ‘active’ channel and subscribe to this channel, making it your currently active one.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | List of channel names your subscribed to |
| Parameter Name | Description |
|---|---|
| newChannel | string type, the channel name. |
public virtual void SetActiveRoomAsChannelName()
Unsubscribe from the previous ‘active’ channel and subscribe to a channel name that is the same as the current Photon Room you’re in.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
protected virtual void SetMyPlayer()
Finds your player and populates internal variables so the chatbox can enable or disable various aspects of your character when the box is open or closed.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
protected virtual void Start()
Used to setup various settings in the chatbox like chat length, chat app settings, authentication values, finding player camera, finding your player, etc.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
public virtual void SubscribeToChannel(string channelName)
The channel name you want to subscribe to.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| channelName | string type, the name of the channel |
public virtual void UnSubscribeToChannel(string channelName)
The channel name you want to un-subscribe from.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| channelName | string type, the name of the channel |
protected virtual void Update()
Used to constantly ping the chat master server to keep that chatbox alive and capture new messages. Also watches for player input to enable/disable the chatbox.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters