Struct NetworkSettings
An aggregate of the different parameter structures that describe a network configuration.
Inherited Members
Namespace: Unity.Networking.Transport
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 readonly bool IsCreated { get; }
Property Value
| Type | Description |
|---|---|
| Boolean | 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 : struct, 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()
Implements
TryGet<T>(out T)
Try to get the parameter structure for the specified type.
Declaration
public bool TryGet<T>(out T parameter)
where T : struct, INetworkParameter
Parameters
| Type | Name | Description |
|---|---|---|
| T | parameter | Stored parameter structure (if true is returned). |
Returns
| Type | Description |
|---|---|
| Boolean | True if the parameter structure is in the settings. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the parameter structure to get. |