Simple Photon Chat App
First of all you need to Create a new net framework library project on visual studio name it whatever you want, and create a new MonoBehaviourPun, also add a RequireComponent attribute on your MonoBehaviourPun class, typeof PhotonView, if MonoBehaviourPun doesn’t exists try add using Photon.Pun on the top.
now create a string list variable or an array or whatever you want.
now we need to write a method to send the message, it’s really simple just List.Add(message); just as simple as that, the most important thing you need is an PunRPC attribute, the method will be sent all over the clients with same room.
now we already have sender method, now all you need just to create a new Window and iterate the cached messages list, Scroll.Set(0, float.MaxValue) in the method isn’t important it is just to make the message scroll always at the bottom so everytime clients received a message the scroll will be comes to the bottom, it’s great you know to makes the message more readable when someone rushed the chat xd, here i’m not going to give 100% codes to you since you need to learn it by yourself instead of just copy paste the source code, but if you still wants the source code i sell it for $19.99 dm me if you’re interested.
next we just need to call the method with PunRPC attribute, use this.PhotonView.RPC(“methodname”, PhotonTarget.All, “Message to send”);, if this looks not good here’s the screenshot for an example to call the RPC method.
done that’s it, hope you understand how to write photon chat now, wanna get my complete source code? dm me <3, eh also don’t forget to Allocate the PhotonView otherwise the message won’t be sent xd.