Struct NetworkSettings
An aggregate of the different parameter structures that describe a network configuration.
Implements
Inherited Members
Namespace: Unity.Networking.Transport
Assembly: Unity.Networking.Transport.dll
Syntax
public struct NetworkSettings : IDisposable
Constructors
NetworkSettings(Allocator)
Creates a new settings object using the provided allocator. If no allocator is
provided, Allocator.Temp
will be used.
Declaration
public NetworkSettings(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | Allocator to use to create the object. |
Properties
IsCreated
If the settings have been created (e.g. not disposed).
Declaration
public bool IsCreated { get; }
Property Value
Type | Description |
---|---|
bool | True if created, false otherwise. |
Methods
AddRawParameterStruct<T>(ref T)
Add a new parameter structure to the list. Only one instance of any parameter type is stored at a time. Adding a new instance of an existing parameter structure will overwrite the one that is already stored.
Declaration
public void AddRawParameterStruct<T>(ref T parameter) where T : unmanaged, INetworkParameter
Parameters
Type | Name | Description |
---|---|---|
T | parameter | Parameter structure to add. |
Type Parameters
Name | Description |
---|---|
T | Type of INetworkParameter to add. |
Exceptions
Type | Condition |
---|---|
ArgumentException | If the parameters contain invalid values. Note that this exception is only thrown when collections checks are enabled (i.e. in the editor). Otherwise an error is logged and the parameters are added anyway. |
AsReadOnly()
Get a read-only copy of the settings.
Declaration
public NetworkSettings AsReadOnly()
Returns
Type | Description |
---|---|
NetworkSettings | A read-only copy of the settings. |
Dispose()
Declaration
public void Dispose()
TryGet<T>(out T)
Try to get the parameter structure for the specified type.
Declaration
public bool TryGet<T>(out T parameter) where T : unmanaged, INetworkParameter
Parameters
Type | Name | Description |
---|---|---|
T | parameter | Stored parameter structure (if true is returned). |
Returns
Type | Description |
---|---|
bool | True if the parameter structure is in the settings. |
Type Parameters
Name | Description |
---|---|
T | Type of the parameter structure to get. |