Mirror/doc/Articles/Guides/BestPractices.md

21 lines
453 B
Markdown
Raw Normal View History

2020-09-12 22:19:42 +00:00
# Best Practices
> work in progress
2020-09-13 11:28:09 +00:00
## 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 : NetworkMessage
2020-09-13 11:28:09 +00:00
{
public Vector3 position;
public Guid prefabId;
// Mirror will automatically implement message that are empty
public void Deserialize(NetworkReader reader) { }
public void Serialize(NetworkWriter writer) { }
}
```