Class DriverMigrationSystem
A system that should be used to temporarly keep the internal transport connections alive while transferring then to another world. For example, you can rely on the DriverMigrationSystem to re-use the same connections in between a lobby world and the game world.
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
[WorldSystemFilter(WorldSystemFilterFlags.LocalSimulation, WorldSystemFilterFlags.Default)]
public class DriverMigrationSystem : SystemBase
Methods
LoadWorld(int, World)
Loads a stored NetworkDriver and Connection data into a new or existing World.
Declaration
public World LoadWorld(int ticket, World newWorld = null)
Parameters
Type | Name | Description |
---|---|---|
int | ticket | A ticket to a stored World |
World | newWorld | An optional world we would want to Load into. |
Returns
Type | Description |
---|---|
World | A prepared world that is ready to have its systems added. |
Remarks
This function needs to be called before any systems are initialized on the world we want to migrate to.
Exceptions
Type | Condition |
---|---|
ArgumentException | Is thrown incase a invalid world is supplied. Only Netcode worlds work. |
StoreWorld(World)
Stores NetworkDriver and Connection data for migration of a specific world.
Declaration
public int StoreWorld(World sourceWorld)
Parameters
Type | Name | Description |
---|---|---|
World | sourceWorld | The world we want to store. |
Returns
Type | Description |
---|---|
int | A ticket that can be used to retrieve the stored NetworkDriver data. |
Remarks
Only entities with the type NetworkStreamConnection
are migrated over to the new World.