Table of Contents

CommandAttribute

class in Coherence.Toolkit
inherits from Attribute

Marks a method to be networked, creating a command.

Remarks

Must be applied to a public method with no return value.

Supported parameter types:

  • Primitive types: int, float, double, bool, char, byte, sbyte, short, ushort, uint, long, ulong
  • Composite types: string, byte[], Color, Vector2, Vector3, Quaternion
  • Unity Object types: GameObjects and Components (read note below).
  • Network identification types: ClientID and Entity.

GameObject and Component arguments will only get synced if they are part of a CoherenceSync prefab. Internally, what's synced is the Entity ID associated with the CoherenceSync prefab.

If a prefab has multiple components of the same type, commands that send those components as arguments might not deliver the specific instance.

When using this attribute successfully, a method binding will be added to the Bindings list. Methods with this attribute will appear on the Configure window as synced, and can only be unsynced by removing the attribute and them unchecking them in the Configure window. Methods without this attribute can be marked as synced via the Configure window directly.

Constructors
CommandAttribute
Fields
defaultRouting

Sets the default routing on the binding (it can still be changed in the bindings configuration window.)

Properties
OldName

What this method name was before.

OldParams

What this method's parameter types were before.

UseMeta

Send command metadata with the command.

See Also