Mirror Networking
Messages.cs
1using System;
2using UnityEngine;
3
4namespace Mirror
5{
6 public struct ReadyMessage : NetworkMessage {}
7
8 public struct NotReadyMessage : NetworkMessage {}
9
11
13 {
14 public string sceneName;
15 // Normal = 0, LoadAdditive = 1, UnloadAdditive = 2
16 public SceneOperation sceneOperation;
17 public bool customHandling;
18 }
19
20 public enum SceneOperation : byte
21 {
22 Normal,
23 LoadAdditive,
24 UnloadAdditive
25 }
26
28 {
29 public uint netId;
30 public byte componentIndex;
31 public ushort functionHash;
32 // the parameters for the Cmd function
33 // -> ArraySegment to avoid unnecessary allocations
34 public ArraySegment<byte> payload;
35 }
36
37 public struct RpcMessage : NetworkMessage
38 {
39 public uint netId;
40 public byte componentIndex;
41 public ushort functionHash;
42 // the parameters for the Cmd function
43 // -> ArraySegment to avoid unnecessary allocations
44 public ArraySegment<byte> payload;
45 }
46
48 {
49 // netId of new or existing object
50 public uint netId;
51 public bool isLocalPlayer;
52 // Sets hasAuthority on the spawned object
53 public bool isOwner;
54 public ulong sceneId;
55 // If sceneId != 0 then it is used instead of assetId
56 public Guid assetId;
57 // Local position
58 public Vector3 position;
59 // Local rotation
60 public Quaternion rotation;
61 // Local scale
62 public Vector3 scale;
63 // serialized component data
64 // ArraySegment to avoid unnecessary allocations
65 public ArraySegment<byte> payload;
66 }
67
69 {
70 public uint netId;
71 public bool isOwner;
72 public bool isLocalPlayer;
73 }
74
76
78
80 {
81 public uint netId;
82 }
83
85 {
86 public uint netId;
87 }
88
90 {
91 public uint netId;
92 // the serialized component data
93 // -> ArraySegment to avoid unnecessary allocations
94 public ArraySegment<byte> payload;
95 }
96
97 // A client sends this message to the server
98 // to calculate RTT and synchronize time
100 {
101 public double clientTime;
102
103 public NetworkPingMessage(double value)
104 {
105 clientTime = value;
106 }
107 }
108
109 // The server responds with this message
110 // The client can use this to calculate RTT and sync time
112 {
113 public double clientTime;
114 public double serverTime;
115 }
116}