Networking & Burst
While Jobs aren’t always a good idea, Burst compiling main thread code is always a good idea.
Burst allows for tremendous performance improvements, usually at least by an order of magnitude. It can make the difference between 10k and 100k entities.
Important: you can not call NetworkServerSystem.Send(Message)
from Burst. Instead, use a NativeMultiMap<connectionId, NetworkMessage>
as a buffer, add your messages from within the Burst ForEach call, and then call NetworkServerSystem.Send(NativeMultiMap)
afterwards.
Even though we have the additional buffer step, the code still runs at least an order of magnitude faster thanks to Burst.
When starting out, don’t worry too much about Burst.
Last updated