ItemNetwork

Network behaviour component for items. Initializes network interaction triggers on spawn by iterating all InteractionContext entries on the item's Interactable and attaching a NetworkTrigger keyed by interaction type name to each one.

Definition

Namespace: Paragon.Townskeep.ItemSystem Assembly: Townskeep.dll

public class ItemNetwork : ParagonNetworkBehaviour

Inheritance: NetworkBehaviourParagonNetworkBehaviour → ItemNetwork

Remarks

ItemNetwork is a lightweight component whose sole responsibility is to bridge the gap between items and the multiplayer interaction system. When an item is spawned on the network, each of its interactions needs a NetworkTrigger so that remote clients can invoke those interactions.

The trigger type string is derived from the interaction's concrete class name (GetType().Name), which serves as a unique identifier for matching network trigger requests to the correct interaction context.

This component is expected to live on the same GameObject as Item and Interactable. It is initialized during Item.Awake() and its OnSpawn() is called from Item.OnSpawn().

Quick Lookup

Goal
How

Initialize with an item

itemNetwork.Initialize(item) — called by Item.Awake()

Register network triggers

itemNetwork.OnSpawn() — called by Item.OnSpawn()

Methods

Initialize

Stores references to the Item and its Interactable component for use during spawn.

Parameter
Type
Description

item

Item

The owning item

OnSpawn

Iterates all InteractionContext entries in the item's InteractionTable and adds a NetworkTrigger to each one. The trigger type is the interaction's concrete class name.

Spawn pipeline:

Common Pitfalls

circle-exclamation
circle-exclamation
circle-exclamation

See Also

Last updated