Update BestPractices.md

This commit is contained in:
James Frowen 2020-09-13 12:28:09 +01:00 committed by GitHub
parent ae9d2e35a9
commit f302e2e8bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,20 @@
# Best Practices # Best Practices
> work in progress > 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) { }
}
```