Game.Prefabs.GroupAmbienceData
Assembly: Game
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
Component data used by the ECS to tag a prefab/group with a specific ambience type. It stores a single value of GroupAmbienceType (an enum defined elsewhere) so systems can query and react to the ambience assigned to an entity or prefab group. This is a simple, blittable component intended for fast queries and storage in archetypes.
Fields
public GroupAmbienceType m_AmbienceType
Stores the ambience classification for the entity/prefab group. The actual possible values are defined by the GroupAmbienceType enum (e.g., None, Park, Residential, Industrial, etc.). This field is public and can be set when creating the component or updated later via EntityManager/SystemAPI.
Properties
- None. This struct exposes only the public field above.
Constructors
public GroupAmbienceData()
No explicit constructors are defined in the source. Use the implicit default constructor or object initializer to set m_AmbienceType, for example: new GroupAmbienceData { m_AmbienceType = GroupAmbienceType.SomeValue }
Methods
- None. This type is a plain data container (IComponentData) and implements IQueryTypeParameter to be usable in queries.
Usage Example
// Add the component to an entity
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = em.CreateEntity(typeof(Game.Prefabs.GroupAmbienceData));
em.SetComponentData(entity, new Game.Prefabs.GroupAmbienceData {
m_AmbienceType = GroupAmbienceType.Park // example enum value
});
// Querying in a system (SystemAPI style)
public partial struct GroupAmbienceSystem : ISystem
{
public void OnUpdate(ref SystemState state)
{
foreach (var (ambience, entity) in SystemAPI.Query<Game.Prefabs.GroupAmbienceData>().WithEntityAccess())
{
// Use ambience.m_AmbienceType to drive behaviour (audio, VFX, etc.)
}
}
}
{{ Notes: Ensure GroupAmbienceType enum is available in the project and that systems that read or write this component use the correct ECS APIs (EntityManager/SystemAPI) and appropriate synchronization when modifying component data. }}