Table of Contents

SendCommand

Methods
public bool SendCommand<TTarget>(string methodName, MessageTarget target, params object[] args) where TTarget : Component

Send a command to another client to call a method on one of its components.

Parameters
Type Name Description
string methodName

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

MessageTarget target

To which clients should this command be sent.

object[] args

The arguments to send to the method, make sure they match its signature.

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
TTarget

The type of the Unity component that contains the method to call.

public bool SendCommand(Type targetType, string methodName, MessageTarget target, params object[] args)

Send a command to another client to call a method on one of its components.

Parameters
Type Name Description
Type targetType

The type of the Unity component that contains the method to call.

string methodName

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

MessageTarget target

To which clients should this command be sent.

object[] args

The arguments to send to the method, make sure they match its signature.

Returns
Type Description
bool

true if the sending was successful.

public bool SendCommand<TTarget>(string methodName, MessageTarget target, params (Type, object)[] args) where TTarget : Component

Send a command to another client to call a method on one of its components.

Parameters
Type Name Description
string methodName

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

MessageTarget target

To which clients should this command be sent.

(Type, object)[] args

The arguments to send to the method, make sure they match its signature. This version of SendCommand uses tuples with the type and the value of each argument, this enables sending of null values.

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
TTarget

The type of the Unity component that contains the method to call.

public bool SendCommand(Type targetType, string methodName, MessageTarget target, params (Type, object)[] args)

Send a command to another client to call a method on one of its components.

Parameters
Type Name Description
Type targetType

The type of the Unity component that contains the method to call.

string methodName

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

MessageTarget target

To which clients should this command be sent.

(Type, object)[] args

The arguments to send to the method, make sure they match its signature. This version of SendCommand uses tuples with the type and the value of each argument, this enables sending of null values.

Returns
Type Description
bool

true if the sending was successful.

public bool SendCommand<TTarget>(string methodName, MessageTarget target) where TTarget : Component

Send a command to another client to call a method on one of its components.

Parameters
Type Name Description
string methodName

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

MessageTarget target

To which clients should this command be sent.

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
TTarget

The type of the Unity component that contains the method to call.

public bool SendCommand(Type targetType, string methodName, MessageTarget target)

Send a command to another client to call a method on one of its components.

Parameters
Type Name Description
Type targetType

The type of the Unity component that contains the method to call.

string methodName

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

MessageTarget target

To which clients should this command be sent.

Returns
Type Description
bool

true if the sending was successful.

public bool SendCommand(Action action, MessageTarget target)

Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.

Parameters
Type Name Description
Action action

Action instance of the component and method command that you wish to send

MessageTarget target

To which clients should this command be sent.

Returns
Type Description
bool

true if the sending was successful.

public bool SendCommand<T>(Action<T> action, MessageTarget target, T param1)

Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.

Parameters
Type Name Description
Action<T> action

Action instance of the component and method command that you wish to send

MessageTarget target

To which clients should this command be sent.

T param1

Argument of type T to send to the method

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
T
public bool SendCommand<T1, T2>(Action<T1, T2> action, MessageTarget target, T1 param1, T2 param2)

Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.

Parameters
Type Name Description
Action<T1, T2> action

Action instance of the component and method command that you wish to send

MessageTarget target

To which clients should this command be sent.

T1 param1

Argument of type T1 to send to the method

T2 param2

Argument of type T2 to send to the method

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
T1
T2
public bool SendCommand<T1, T2, T3>(Action<T1, T2, T3> action, MessageTarget target, T1 param1, T2 param2, T3 param3)

Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.

Parameters
Type Name Description
Action<T1, T2, T3> action

Action instance of the component and method command that you wish to send

MessageTarget target

To which clients should this command be sent.

T1 param1

Argument of type T1 to send to the method

T2 param2

Argument of type T2 to send to the method

T3 param3

Argument of type T3 to send to the method

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
T1
T2
T3
public bool SendCommand<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4)

Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.

Parameters
Type Name Description
Action<T1, T2, T3, T4> action

Action instance of the component and method command that you wish to send

MessageTarget target

To which clients should this command be sent.

T1 param1

Argument of type T1 to send to the method

T2 param2

Argument of type T2 to send to the method

T3 param3

Argument of type T3 to send to the method

T4 param4

Argument of type T4 to send to the method

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
T1
T2
T3
T4
public bool SendCommand<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5)

Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.

Parameters
Type Name Description
Action<T1, T2, T3, T4, T5> action

Action instance of the component and method command that you wish to send

MessageTarget target

To which clients should this command be sent.

T1 param1

Argument of type T1 to send to the method

T2 param2

Argument of type T2 to send to the method

T3 param3

Argument of type T3 to send to the method

T4 param4

Argument of type T4 to send to the method

T5 param5

Argument of type T5 to send to the method

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
T1
T2
T3
T4
T5
public bool SendCommand<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6)

Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.

Parameters
Type Name Description
Action<T1, T2, T3, T4, T5, T6> action

Action instance of the component and method command that you wish to send

MessageTarget target

To which clients should this command be sent.

T1 param1

Argument of type T1 to send to the method

T2 param2

Argument of type T2 to send to the method

T3 param3

Argument of type T3 to send to the method

T4 param4

Argument of type T4 to send to the method

T5 param5

Argument of type T5 to send to the method

T6 param6

Argument of type T6 to send to the method

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
T1
T2
T3
T4
T5
T6
public bool SendCommand<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7)

Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.

Parameters
Type Name Description
Action<T1, T2, T3, T4, T5, T6, T7> action

Action instance of the component and method command that you wish to send

MessageTarget target

To which clients should this command be sent.

T1 param1

Argument of type T1 to send to the method

T2 param2

Argument of type T2 to send to the method

T3 param3

Argument of type T3 to send to the method

T4 param4

Argument of type T4 to send to the method

T5 param5

Argument of type T5 to send to the method

T6 param6

Argument of type T6 to send to the method

T7 param7

Argument of type T7 to send to the method

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
T1
T2
T3
T4
T5
T6
T7
public bool SendCommand<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7, T8 param8)

Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.

Parameters
Type Name Description
Action<T1, T2, T3, T4, T5, T6, T7, T8> action

Action instance of the component and method command that you wish to send

MessageTarget target

To which clients should this command be sent.

T1 param1

Argument of type T1 to send to the method

T2 param2

Argument of type T2 to send to the method

T3 param3

Argument of type T3 to send to the method

T4 param4

Argument of type T4 to send to the method

T5 param5

Argument of type T5 to send to the method

T6 param6

Argument of type T6 to send to the method

T7 param7

Argument of type T7 to send to the method

T8 param8

Argument of type T8 to send to the method

Returns
Type Description
bool

true if the sending was successful.

Type Parameters
Name Description
T1
T2
T3
T4
T5
T6
T7
T8