ItemData
Serializable data record holding the definition of an item type. Extends FactorableData from the Scriptable Factory system and provides fields used by Item during initialization.
Definition
Namespace: Paragon.Townskeep.ItemSystem Assembly: Townskeep.dll
[Serializable]
public record ItemData : FactorableDataInheritance: FactorableData → ItemData
Remarks
ItemData is a C# record (value equality semantics) that serves as the data payload for the item factory pipeline. When an Item is spawned, InitializeData(ItemData) copies fields from this record into the item's runtime state.
Fields marked with [Overridable] can be overridden per variant in the Scriptable Factory variant system. This means a base item definition can have its Name, Icon, Value, or VariantID customized per variant without duplicating the entire data record.
The InteractionTable field configures which interactions are available when the item is placed in the world (e.g., pick up, inspect, use).
Quick Lookup
Define a new item type
Create an ItemFactory<T, TData> ScriptableObject with ItemData
Override per variant
Mark fields with [Overridable] attribute
Set item price
Assign Value field (type Coin)
Configure interactions
Assign InteractionTable field
Fields
ItemID
Unique integer identifier for this item type within the ItemDatabase.
VariantID
Variant index within the factory. Marked [Overridable] and [HideInInspector] — set automatically by the variant system.
Name
Display name of the item. Marked [Overridable] for per-variant customization.
Icon
Sprite displayed in inventory UI and tooltips. Marked [Overridable] for per-variant customization.
Value
Monetary value of the item as a Coin. Marked [Overridable] for per-variant pricing. Defaults to 0.
InteractionTable
The InteractionTable defining which interactions are available when this item is placed in the world.
Common Pitfalls
ItemID vs ItemID struct The ItemData.ItemID field is a plain int, while the ItemID struct combines TypeID and VariantID. When constructing an ItemID struct from data, use new ItemID(data.ItemID, data.VariantID) or the implicit tuple conversion (data.ItemID, data.VariantID).
InteractionTable is not Overridable Unlike Name, Icon, and Value, the InteractionTable field is not marked [Overridable]. All variants of an item share the same interaction table. To have different interactions per variant, use separate factory assets.
Record equality and mutable fields ItemData is a record, so equality is value-based. However, fields like InteractionTable are reference types — two ItemData instances with different InteractionTable references but identical content may not compare as equal.
See Also
ItemID — composite type/variant identifier struct
Item — runtime MonoBehaviour consuming this data
ItemFactory — factory that holds and applies this data
ItemDatabase — registry of all item factories
Coin — currency type used for
ValueInteractionTable — interaction configuration
Last updated