Skip to content

Game.Prefabs.AssetStampPrefab

Assembly: Assembly-CSharp (game)
Namespace: Game.Prefabs

Type: class

Base: ObjectPrefab

Summary:
AssetStampPrefab defines a placeable "asset stamp" prefab used by the game to create multi-tile placeable objects (stamped assets). It exposes tile dimensions, cost values and registers the runtime ECS component types (both prefab and archetype components) required for this object to function. The class is marked with a ComponentMenu attribute so it can be found in the editor asset menus.


Fields

  • public int m_Width
    Range: 1 — 1000, default 4.
    Marked with [InputField] and [Range(1f, 1000f)]. Specifies the width of the stamp in world tiles/units. Controls how many grid cells the asset covers along the X axis.

  • public int m_Depth
    Range: 1 — 1000, default 4.
    Marked with [InputField] and [Range(1f, 1000f)]. Specifies the depth of the stamp in world tiles/units. Controls how many grid cells the asset covers along the Z axis.

  • public uint m_ConstructionCost
    Unsigned integer representing the one-time construction cost of placing this asset stamp.

  • public uint m_UpKeepCost
    Unsigned integer representing the ongoing upkeep cost for this asset stamp.

Properties

  • public override bool canIgnoreUnlockDependencies { get; }
    Always returns false (override). Indicates that this prefab cannot ignore unlock dependencies — the game will respect whatever unlock requirements are defined for the asset (for example, tech/level unlocks).

Constructors

  • public AssetStampPrefab()
    Default constructor. Fields use their declared defaults (m_Width = 4, m_Depth = 4, other numeric fields default to 0). Prefab instances are typically created/managed by the game's asset pipeline and editor rather than manually instantiated at runtime.

Methods

  • public override void GetPrefabComponents(System.Collections.Generic.HashSet<ComponentType> components)
    Adds component types required on the prefab (entity template) for this object at the prefab/component-data level. This implementation calls the base and then adds:
  • ObjectGeometryData (ReadWrite)
  • AssetStampData (ReadWrite)
  • PlaceableObjectData (ReadWrite)

These components store geometry and stamp-specific data and metadata needed before the final runtime archetype is created.

  • public override void GetArchetypeComponents(System.Collections.Generic.HashSet<ComponentType> components)
    Adds component types required on the runtime archetype (actual spawned entities). This implementation calls the base and then adds:
  • Static (ReadWrite)
  • AssetStamp (ReadWrite)
  • CullingInfo (ReadWrite)
  • PseudoRandomSeed (ReadWrite)

These components make the entity static, tag it as an asset stamp, provide culling information for rendering, and supply a deterministic seed for per-instance randomness.

Usage Example

// Example: read stamp properties from an AssetStampPrefab instance
AssetStampPrefab stampPrefab = /* obtain prefab from asset manager or inspector */;
int width = stampPrefab.m_Width;
int depth = stampPrefab.m_Depth;
uint buildCost = stampPrefab.m_ConstructionCost;
uint upkeep = stampPrefab.m_UpKeepCost;

// The prefab will ensure needed ECS component types are added when the engine creates
// prefab/component templates and runtime entity archetypes via GetPrefabComponents
// and GetArchetypeComponents respectively.

Additional notes: - The [ComponentMenu("Objects/", ...)] attribute places this prefab under the "Objects" menu in the editor UI. - The [InputField] attributes indicate these fields are editable in the in-game editor/inspector and the [Range] enforces bounds for width/depth.