perf: SceneMessage is now a value type (#989)

This commit is contained in:
Paul Pacheco 2019-07-29 08:52:46 -05:00 committed by vis2k
parent f99e71ebdf
commit 407b36acb7

View File

@ -179,20 +179,20 @@ public void Deserialize(NetworkReader reader) { }
public void Serialize(NetworkWriter writer) { } public void Serialize(NetworkWriter writer) { }
} }
public class SceneMessage : MessageBase public struct SceneMessage : IMessageBase
{ {
public string sceneName; public string sceneName;
public LoadSceneMode sceneMode; // Single = 0, Additive = 1 public LoadSceneMode sceneMode; // Single = 0, Additive = 1
public LocalPhysicsMode physicsMode; // None = 0, Physics3D = 1, Physics2D = 2 public LocalPhysicsMode physicsMode; // None = 0, Physics3D = 1, Physics2D = 2
public override void Deserialize(NetworkReader reader) public void Deserialize(NetworkReader reader)
{ {
sceneName = reader.ReadString(); sceneName = reader.ReadString();
sceneMode = (LoadSceneMode)reader.ReadByte(); sceneMode = (LoadSceneMode)reader.ReadByte();
physicsMode = (LocalPhysicsMode)reader.ReadByte(); physicsMode = (LocalPhysicsMode)reader.ReadByte();
} }
public override void Serialize(NetworkWriter writer) public void Serialize(NetworkWriter writer)
{ {
writer.WriteString(sceneName); writer.WriteString(sceneName);
writer.WriteByte((byte)sceneMode); writer.WriteByte((byte)sceneMode);