Skip to content

Game.Prefabs.AssetStampData

Assembly:
Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
AssetStampData is a lightweight ECS component used to store placement/footprint metadata for an asset prefab. It records the 2D footprint size (in grid/cell units) and the asset's ongoing upkeep/maintenance cost. This struct is intended as plain data for simulation and placement systems (e.g., collision/placement checks, budget calculations).


Fields

  • public Unity.Mathematics.int2 m_Size
    Represents the 2D size of the asset stamp (x = width, y = height) in integer grid/cell units. Systems that perform placement, snapping, or area checks should read this to determine the asset footprint. Uses Unity.Mathematics.int2.

  • public System.UInt32 m_UpKeepCost
    Unsigned integer storing the asset's upkeep (maintenance) cost. Interpreted by simulation/budget systems as the recurring cost associated with the asset. The unit (per second, per game tick, per month, etc.) depends on the surrounding game logic — treat this as the raw cost value used by budgeting systems.

Properties

  • This struct does not define any C# properties; it exposes public fields only.

Constructors

  • public AssetStampData()
    Implicit default constructor (struct) initializes fields to their default values: m_Size == int2.zero, m_UpKeepCost == 0. You can also create and initialize with an object initializer.

Methods

  • This type defines no methods. It is a plain data container (IComponentData) used by ECS systems.

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;

// create a stamp and add to an entity
var stamp = new AssetStampData {
    m_Size = new int2(3, 2),
    m_UpKeepCost = 500u
};

EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponentData(someEntity, stamp);

// or when creating an entity with an archetype
var archetype = entityManager.CreateArchetype(typeof(AssetStampData), /* other components */);
Entity e = entityManager.CreateEntity(archetype);
entityManager.SetComponentData(e, stamp);