Skip to content

Game.Prefabs.LimitSettingData

Assembly:
Assembly-CSharp (typical for Unity projects / Cities: Skylines 2 mods)
Namespace:
Game.Prefabs

Type:
struct

Base:
System.ValueType, implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
LimitSettingData is a small ECS component used to store a single integer that represents a maximum "chirps" limit (or similar per-entity limit) for an entity. It is a plain, blittable value type suitable for use with Unity's DOTS/ECS systems. As it implements IComponentData it can be added to entities; IQueryTypeParameter allows it to be used in certain query-related contexts (depending on Unity.Entities version). Use this component to attach a simple scalar limit value to entities that need a configurable maximum.


Fields

  • public int m_MaxChirpsLimit
    Holds the configured maximum limit (for example, maximum number of chirps). Default value for the field is 0 when the struct is default-constructed. The naming follows the project's m_ prefix convention.

Properties

  • This type defines no properties. Access the value directly via the public field m_MaxChirpsLimit.

Constructors

  • public LimitSettingData()
    No custom constructors are defined. The default struct constructor initializes m_MaxChirpsLimit to 0. When creating instances, set m_MaxChirpsLimit explicitly if a non-zero default is required.

Methods

  • This type defines no methods. It is a plain data container intended to be used as an IComponentData.

Usage Example

using Unity.Entities;
using Game.Prefabs;

// Create an entity with the LimitSettingData component
public class CreateLimitEntitySystem : SystemBase
{
    protected override void OnCreate()
    {
        var em = World.DefaultGameObjectInjectionWorld.EntityManager;

        // Create an archetype that includes LimitSettingData
        var archetype = em.CreateArchetype(typeof(LimitSettingData));

        // Create an entity with that archetype
        var entity = em.CreateEntity(archetype);

        // Set the limit value
        em.SetComponentData(entity, new LimitSettingData { m_MaxChirpsLimit = 10 });
    }

    protected override void OnUpdate() { }
}

// Alternatively, add or modify the component on an existing entity:
em.AddComponentData(existingEntity, new LimitSettingData { m_MaxChirpsLimit = 5 });

Additional notes: - Because this is a blittable IComponentData struct, it is safe and efficient to use inside Jobs and ECS systems. - If you rely on IQueryTypeParameter semantics, check the exact Unity.Entities version used by Cities: Skylines 2, as API details and query usage can vary between DOTS/ECS releases.