mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Update BestPractices.md
This commit is contained in:
parent
ae9d2e35a9
commit
f302e2e8bf
@ -1,3 +1,20 @@
|
||||
# Best Practices
|
||||
|
||||
> work in progress
|
||||
|
||||
|
||||
## Custom Messages
|
||||
|
||||
If you send custom message regularly then the message should be a struct so that there is no GC/allocations
|
||||
|
||||
```cs
|
||||
struct CreateVisualEffect : IMessageBase
|
||||
{
|
||||
public Vector3 position;
|
||||
public Guid prefabId;
|
||||
|
||||
// Mirror will automatically implement message that are empty
|
||||
public void Deserialize(NetworkReader reader) { }
|
||||
public void Serialize(NetworkWriter writer) { }
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user