how to add private chat in multuplayer game.

Hi everybody, i have created multiplayer game using photon network service. here i want to add private chat by click on remote player chat window should be open for both players.
I have tried following script/tricks but its work for only public chat not particular player bcoz of photonTargets.

this.photonView.RPC (“Chat”, PhotonTargets.All, this.inputLine);

here only photonTargets.All, OthersBuffered, AllBuffered & MasterClient is there.
thats why message going to public. but i wnat it will be something like(photonTargets.clickedPlayer) here clickedPlayer is the player there only messase shold go.


To send a message only to a specific player, you would provide the photon player there instead of PhotonTargets
The PhotonTargets enumeration is meant for cases where you want to target whole parts of the room.

Like finding id of players we can send messages to particular player.
Thanks for Dreamora Concepts

if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return)) {
				if (!string.IsNullOrEmpty (this.inputLine)) {
					if(photonView.owner == PhotonPlayer.Find (RecieverId)){
						this.photonView.RPC ("Chat", PhotonPlayer.Find (RecieverId), this.inputLine);
						this.photonView.RPC ("Chat", PhotonPlayer.Find (SenderId), this.inputLine);
					messages.Add (PhotonNetwork.playerName + ": " + inputLine);
					this.inputLine = "";
					GUI.FocusControl ("");
					return; // printing the now modified list would result in an error. to avoid this, we just skip this single frame
				} else {
					GUI.FocusControl ("ChatInput");

	public void Chat(string newLine, PhotonMessageInfo mi)
		string senderName = "anonymous";
		if (mi != null && mi.sender != null)
			if (!string.IsNullOrEmpty(
				senderName =;
				senderName = "player " + mi.sender.ID;
		this.messages.Add(senderName +": " + newLine);