Skip to main content

TSMPNetworkBehaviour

TSMPNetworkBehaviour is the base component for data that TSMP can send or receive.

Most users interact with the ready-made TSMP network components listed in Sync components. You only need to understand the shared settings that appear on each component.

Network ID​

Each synchronized component has a network ID. Sender and receiver use this ID to match messages to objects.

Use TSMPSetup to assign and refresh IDs. Edit IDs manually only when you need a fixed mapping.

Rules:

  • IDs must be unique among active TSMP network behaviours that share a stream.
  • Sender and receiver must agree on IDs.
  • Re-run Apply Setup after adding, deleting, or moving components.
  • If two behaviours share the same network ID, the receiver may apply data to the wrong object or ignore messages.

Treat manual IDs as an advanced option. The Inspector locks the field by default to prevent accidental changes.

Send Mode​

Choose Send Mode on the sending component, directly below Network ID. You do not need to edit its script or change the Encoder's refresh interval for every other component.

ModeWhat is sent
DefaultUses each field's TransSync.SendOnChange setting. This is the default and preserves existing behavior.
On ChangeSends the first value, then changes and periodic refreshes, even for fields whose author disabled change detection.
AlwaysConsiders unchanged values for every encode as well as changed values. Use this to repeat a stationary Transform or a paused Timeline's state more frequently.

On Change uses the Encoder's Trans Sync Refresh Interval (default: 1 second). Set that interval to 0 to disable unchanged-value refresh. Always does not wait for a refresh, but still respects each field's minimum send interval, enabled state, direction, priority and available payload capacity. It increases traffic; it does not guarantee delivery or automatically raise priority.

The setting affects all automatic [TransSync] fields on this component, not other components, RPCs or manual Writer calls. It does not change how the component captures or packs its data. For different policies per field, use Default and configure the field attributes.

Changing Send Mode takes effect on the next eligible encode without Apply Setup. It works in ordinary Unity and UdonSharp. The receiving component's Receive Interpolation setting remains independent.

Receive interpolation​

Set receive interpolation per component:

ModeUse when
NoneThis object should not apply received values. Useful for sender-only objects.
DiscreteThe value should snap to the newest received state. Good for events, toggles, animator state, and low-rate values.
ContinuousThe value should move smoothly between received states. Good for transforms and pose targets that support smoothing.

None does not stop the component from sending. It only tells the receiver side to ignore incoming values on that component.

In None mode, incoming TransSync values do not overwrite fields or the contents of previously received arrays. The decoder also leaves lastVariableHash unchanged and does not call OnTSMPVariableReceived. Switching back to Discrete or Continuous allows subsequent values to be received again. This setting does not disable RPC reception.

Active state​

TSMP uses component and GameObject active state as the main on/off switch.

  • Disable the component to stop that behaviour from participating.
  • Disable the GameObject to stop all TSMP behaviours on it.
  • Re-run setup if you add, remove, or permanently reorganize synced objects.

Temporary runtime enable/disable state is respected during encode and receive. Permanent scene structure changes should be followed by Apply Setup.

Sending an RPC​

Use SendTransRPC from a TSMPNetworkBehaviour:

SendTransRPC(nameof(ToggleObject), RPCTarget.All);

Targets:

TargetWhat happens
LocalOnly the caller runs the method. Nothing is sent through TSMP.
RemoteOnly receivers run the method after the stream delay.
AllCaller runs now, receivers run after the stream delay.

For a minimal example, use TSMPNetworkGameObjectToggle.

When receiver objects do not update​

Check:

  1. The receiver component is enabled and active.
  2. Receive interpolation is not None.
  3. The network ID matches the sender.
  4. TSMPSetup was applied after the component was added.
  5. Decoder message count is greater than zero.