Duplicating chat messages

edited February 2015 in Photon Chat
Hello! I've been having a problem with some code from photon's chat demo that I've been using to make my own chat to my liking but hit a problem with duplicating chat messages here is the code:

public void OnGetMessages(string channelName, string[] senders, object[] messages)
if (this.chatClient.TryGetChannel(selectedChannelName, this.doingPrivateChat, out this.selectedChannel))
for (int i = 0; i < this.selectedChannel.Messages.Count; i++)
string sender = this.selectedChannel.Senders;
object message = this.selectedChannel.Messages;
Debug.Log (string.Format("{0}: {1}", sender, message.ToString()));
GameObject ChatText = (GameObject)Instantiate(Resources.Load("PlayerMessage"));
ChatText.transform.SetParent(GameObject.Find ("Image").transform,false);

what i'm tying so do here is instantiate a UI text and set its parent to my chat scroll bar but when ever I send a message each one will add another


Hello hello hi
Hello hello hello hi hi


  • The channels include all messages. Not just the new ones (which are in the messages parameter). The new message is provided to you AND stored in the channel.Messages list.
Sign In or Register to comment.