InRoomChat
How do I use In Room Chat
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
39 |
InRoomChat chatComponent = GetComponent |
1 |
File name: WorkerInGame.cs
Copy
34 public void OnMasterClientSwitched(PhotonPlayer player)
35 {
36 Debug.Log("OnMasterClientSwitched: " + player);
37
38 string message;
39 InRoomChat chatComponent = GetComponent
40
41 if (chatComponent != null)
42 {
43 // to check if this client is the new master...
44 if (player.isLocal)
45 {
46 message = "You are Master Client now.";
47 }
48 else
49 {
50 message = player.name + " is Master Client now.";
51 }
52
53
54 chatComponent.AddLine(message); // the Chat method is a RPC. as we don't want to send an RPC and neither create a PhotonMessageInfo, lets call AddLine()
55 }
56 }
Download file with original file name:InRoomChat
InRoomChat 169 lượt xem
Gõ tìm kiếm nhanh...