Table of Contents

SendCommandToChildren

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

Send a command to another client to call a method to every component in the hierarchy that has methodName bound.

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 SendCommandToChildren(Type targetType, string methodName, MessageTarget target, params object[] args)

Send a command to another client to call a method to every component in the hierarchy that has methodName bound.

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 SendCommandToChildren<TTarget>(string methodName, MessageTarget target, params (Type, object)[] args) where TTarget : Component

Send a command to another client to call a method to every component in the hierarchy that has methodName bound.

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 SendCommandToChildren(Type targetType, string methodName, MessageTarget target, params (Type, object)[] args)

Send a command to another client to call a method to every component in the hierarchy that has methodName bound.

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 SendCommandToChildren<TTarget>(string methodName, MessageTarget target) where TTarget : Component

Send a command to another client to call a method to every component in the hierarchy that has methodName bound.

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 SendCommandToChildren(Type targetType, string methodName, MessageTarget target)

Send a command to another client to call a method to every component in the hierarchy that has methodName bound.

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.