Class CreateSessionOptions
Session Creation Options
Inherited Members
Namespace: Unity.Services.Multiplayer
Assembly: Unity.Services.Multiplayer.dll
Syntax
public class CreateSessionOptions
Constructors
CreateSessionOptions(int)
Declaration
public CreateSessionOptions(int maxPlayers)
Parameters
Type | Name | Description |
---|---|---|
int | maxPlayers |
Properties
HasConnection
True if the session options was provided connection options, false otherwise.
Declaration
public bool HasConnection { get; }
Property Value
Type | Description |
---|---|
bool |
IsLocked
A locked session does not allow any more players to join. True if the session is locked, false otherwise.
Declaration
public bool IsLocked { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsPrivate
True if the session is private, false otherwise.
Declaration
public bool IsPrivate { get; set; }
Property Value
Type | Description |
---|---|
bool |
MaxPlayers
The max number of players (including host) allowed in the session.
Declaration
public int MaxPlayers { get; set; }
Property Value
Type | Description |
---|---|
int |
Name
The name of the session.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Password
The session password.
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
string |
PlayerProperties
Custom game-specific properties that apply to the player (e.g. role
or skill
).
Declaration
public Dictionary<string, PlayerProperty> PlayerProperties { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, Player |
PostBuildHook
The post build hook. Only called on the host after the session creation.
Declaration
public Func<ISession, Task> PostBuildHook { get; set; }
Property Value
SessionProperties
The session custom data.
Declaration
public Dictionary<string, SessionProperty> SessionProperties { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, Session |
Methods
WithDirectConnection(string, int, string)
Provides a direct connection to the session
Declaration
public CreateSessionOptions WithDirectConnection(string ip, int port, string listenAddress = null)
Parameters
Type | Name | Description |
---|---|---|
string | ip | The ip to connect to. |
int | port | The port to connect to. |
string | listenAddress | The address to listen for messages. |
Returns
Type | Description |
---|---|
Create |
The session creation options |
WithRelayConnection(string)
Provides a relayed connection to the session
Declaration
public CreateSessionOptions WithRelayConnection(string region = null)
Parameters
Type | Name | Description |
---|---|---|
string | region | The region used to create the relay session. |
Returns
Type | Description |
---|---|
Create |
The session creation options |