Game.ParkParameterData
Assembly:
Assembly-CSharp (typical for game code / mods).
{{ This struct is defined in the game's runtime assembly (commonly Assembly-CSharp) and used by the Entities-based (ECS) systems. }}
Namespace:
Game.Prefabs
{{ Declared under Game.Prefabs; groups prefab-related ECS components and parameters for park prefabs. }}
Type:
struct (value type)
{{ A plain value-type component used with Unity Entities (ECS). }}
Base:
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
{{ IComponentData marks this struct as a component that can be attached to entities. IQueryTypeParameter is used as a marker/parameter type for query/baking APIs so this type can be referenced in queries or baking contexts. }}
Summary:
A simple ECS component that stores a reference to a park service prefab entity.
{{ Use this component to carry the Entity that represents the park service prefab (for instantiation, factory systems, or to pass prefab references through entity queries). }}
Fields
public Unity.Entities.Entity m_ParkServicePrefab
{{ Holds the Entity handle of the park service prefab. When systems or factories need to instantiate a park service, they read this field to obtain the prefab Entity to instantiate or spawn. The field is public and part of the component data, so it is serializable/storable on entities. }}
Properties
- None
{{ This struct exposes its data via the public field only; there are no properties or computed accessors. }}
Constructors
- Implicit default constructor (value-type)
{{ As a struct, ParkParameterData has the implicit default constructor that initializes m_ParkServicePrefab to Entity.Null. If you need a non-null prefab reference, assign one explicitly after creating the struct or when adding the component to an entity. Example: new ParkParameterData { m_ParkServicePrefab = prefabEntity } }}
Methods
- None
{{ There are no methods defined on this struct. Behavior associated with this data is implemented in systems that read/write this component. }}
Usage Example
// Example: assign a prefab entity to an entity as ParkParameterData
using Unity.Entities;
using Game.Prefabs;
public void AddParkParameter(EntityManager entityManager, Entity targetEntity, Entity parkPrefab)
{
var parkParam = new ParkParameterData {
m_ParkServicePrefab = parkPrefab
};
entityManager.AddComponentData(targetEntity, parkParam);
}
// Example: system read usage (pseudo-code)
public partial class ParkSpawnSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<ParkParameterData>()
.ForEach((ref ParkParameterData param, in SomeOtherTag tag) =>
{
// param.m_ParkServicePrefab is the prefab entity to instantiate
// Instantiate logic here, e.g. EntityManager.Instantiate(param.m_ParkServicePrefab)
}).Schedule();
}
}
{{ Typical usage patterns: assign a prefab entity to this component on a "spawner" or configuration entity, and have systems read the component to instantiate or configure park service instances. Ensure the referenced prefab Entity is valid (not Entity.Null) before instantiation. }}