The configuration of the
NetworkDriver is defined using the
NetworkSettings API. It might be required to change some of the default values of the parameters, that can be done as in the following example.
When extending Unity Transport it is often useful to add custom parameters or settings that users can set to define the configuration of the
That can be done by extending the
NetworkSettings API so the custom Network Interfaces or Pipelines can capture the parameter values inside the Initialization method as detailed in the following sections.
By implementing the
INetworkParameter interface, any unmanaged struct can be identified as a network parameter that can be assigned to the
IValidatableNetworkParameter interface can be implemented if any validation is required for a
NetworkSettings will automatically call the
Validate() method and will throw an exception if
false is returned.
Every new custom
INetworkParameter requires of at least one extension method to the
NetworkSettings API. These extension methods must receive and return a
ref NetworkSettings to ensure the proper functioning of the fluent interface.
Those constraints are checked by the Roslyn Analyzers provided in the Unity Transport package.