mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Revert "doc: messages can be struct now"
This reverts commit bb72643c1e
.
This commit is contained in:
parent
bb72643c1e
commit
79f7c81520
@ -4,16 +4,16 @@ For the most part we recommend the high level [Commands and RPC](RemoteActions.m
|
||||
|
||||
There is a class called MessageBase that you can extend to make serializable network message classes. This class has Serialize and Deserialize functions that take writer and reader objects. You can implement these functions yourself, but we recommend you let Mirror generate them for you.
|
||||
|
||||
The base interface looks like this:
|
||||
The base class looks like this:
|
||||
|
||||
```cs
|
||||
public interface IMessageBase
|
||||
public abstract class MessageBase
|
||||
{
|
||||
// Deserialize the contents of the reader into this message
|
||||
void Deserialize(NetworkReader reader);
|
||||
public virtual void Deserialize(NetworkReader reader) {}
|
||||
|
||||
// Serialize the contents of this message into the writer
|
||||
void Serialize(NetworkWriter writer);
|
||||
public virtual void Serialize(NetworkWriter writer) {}
|
||||
}
|
||||
```
|
||||
|
||||
@ -31,7 +31,7 @@ public class Scores : MonoBehaviour
|
||||
{
|
||||
NetworkClient myClient;
|
||||
|
||||
public struct ScoreMessage : IMessageBase
|
||||
public class ScoreMessage : MessageBase
|
||||
{
|
||||
public int score;
|
||||
public Vector3 scorePos;
|
||||
|
Loading…
Reference in New Issue
Block a user