RPC Acting Strangely?

edited June 2014 in Any Topic & Chat
Hello forum readers!

First off, I would like to apologize at the length of this post. I have just recently started with networking in Unity and Photon was by far the best way to go. In just the few hours that I have been playing around with Photon I have learned so much! However, I am now at a loss and I can't figure out what is going on.

After going through the Marco Polo tutorial, I decided to experiment and built a very basic chat messenger program. Amazingly, it seems to work...for the most part. I have included all three scripts as attachments, but to summarize them there is the Matchmaker script (pretty much pulled from Marco Polo) and the MessengerNetwork script which only contains the contents of the chat window in a static list of strings. Finally there is the MessengerBehavior script which handles everything else (such as the GUI and is suppose to act as a single user, containing their name and message they are typing).

So the weird part now is that when a user presses send or logs in, it adds a message to the GlobalMessages in the MessengerNetwork script. It only shows the message caused by login to the respective user, which seems weird to me because it is a single static list. It should show every message by every user, no matter how it was added to the list. Also, from what I understand each message should be added twice because it is contained in the RPC and I am using PhotonTarget.All, but it doesn't. That is what I am thinking at least.

Again, sorry for the length of this post, but this is baffling to me. Any help or clarification on what is going on would help me out tremendously!



  • The RPCs are not behaving strangely. The RPC does not know that you want to store the messages in a static list that should be synced across all clients.
    RPCs are sent as events in Photon. Those are by default not stored and anything that happened before you join a room will be unknown to a joining client.
    You can buffer RPCs but that's a bad idea for chats. You will get a LOT of messages over time in a room and new players will have to get those when they join - no matter how long the chat (and game!) was going on.

    Possibly you would like to use the Photon Chat solution in cooperation with PUN. It's it better suited for this kind of scenario and has a cache of messages that is limited to (I think) past 20 messages per channel.
    It should be way better suited.

    See: http://doc.exitgames.com/en/chat/curren ... chat-intro