Skip to content

Game.Prefabs.AssetPackData

Assembly: Assembly-CSharp (typical Unity/Cities: Skylines 2 project assembly; actual assembly may vary)
Namespace: Game.Prefabs

Type: struct

Base: Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
AssetPackData is an empty marker/component struct used with Unity's ECS to tag entities that represent an "asset pack" in the game's prefab/asset system. The struct is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] so it has a non-zero layout size (1 byte). This pattern is commonly used for marker components where no payload data is needed but a stable, non-zero memory footprint or explicit layout is desired (for interop, tooling, or to avoid special-casing of zero-sized components).


Fields

  • This struct defines no instance fields. It is intentionally empty and used purely as a marker/tag component.

Properties

  • This struct defines no properties.

Constructors

  • No explicit constructors are defined. As a value type it can be default-initialized (e.g., new AssetPackData() or default(AssetPackData)).

Methods

  • No methods are defined on this type.

Usage Example

// Create an entity that represents an asset pack and tag it:
Entity assetPackEntity = entityManager.CreateEntity(typeof(AssetPackData));

// Alternatively add the marker to an existing entity:
entityManager.AddComponentData(existingEntity, new AssetPackData());

// Query systems for entities that have the AssetPackData tag:
EntityQuery assetPackQuery = GetEntityQuery(ComponentType.ReadOnly<AssetPackData>());
// Or in a system:
Entities.WithAll<AssetPackData>().ForEach((Entity e) =>
{
    // operate on asset-pack entities
});

Notes: - Being a marker component, AssetPackData is intended to be used solely for identification/filtering in queries and systems; store any associated data in separate components. - The StructLayout attribute forces a 1-byte size; this can be important to avoid platform/tooling issues related to true zero-sized components in some contexts.