Send to Authority Onlymode can be sent only to the authority of the target Entity, while ones with the
Send to All Instancescan be broadcasted to all clients that have a copy of this Entity. The routing is enforced by the Replication Server as a security measure so that outdated or malicious clients don't break the game.
SendCommand<>method on the target
CoherenceSyncobject. It takes a number of arguments:
>) must be the type of the receiving MonoBehaviour. This ensures that the correct method gets called if the receiving GameObject has components that implement methods that share the same name.
nameofexpression when referring to the method name, since it prevents accidentally misspelling it, or forgetting to update the string if the method changes name.
MessageTargetof the command. The possible values are:
MessageTarget.All– sends the command to each Client that has an instance of this Entity.
MessageTarget.AuthorityOnly– send the command only to the Client that has authority over the Entity.
MessageTarget.Other- sends the command to every Entity other than the one SendCommand is called on.
SendCommandwill recognize that and not send a network command, but instead simply call the method directly.