Game.Creatures.AmbienceEmitter
Assembly:
Unknown (not specified in source; typically compiled into Assembly-CSharp or a game-specific assembly)
Namespace: Game.Creatures
Type: struct
Base: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
AmbienceEmitter is an empty marker component used with Unity's ECS to tag entities that act as ambience (sound/atmosphere) emitters for creatures. The struct is explicitly given a sequential layout with Size = 1 so it occupies a single byte when serialized/stored, allowing it to serve as a minimal marker without instance fields. It implements IComponentData for use as a component, IQueryTypeParameter to be used directly in queries, and IEmptySerializable to support empty/compact serialization used by the game's entity serialization system.
Fields
- None.
This struct declares no instance fields. Its size and layout are controlled by the StructLayout attribute (LayoutKind.Sequential, Size = 1) to ensure a compact, non-zero size representation for serialization and ECS storage.
Properties
- None.
There are no properties defined on this type; it functions as a pure marker component.
Constructors
- Implicit parameterless constructor (default for structs).
Since no constructor is defined, the compiler-provided default constructor is used. The component is intended to be added as a value-type marker (new AmbienceEmitter()).
Methods
- None.
The type contains no methods; behavior is provided by systems that query for this component.
Usage Example
// Add the marker to an entity using EntityManager
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = em.CreateEntity();
em.AddComponentData(entity, new Game.Creatures.AmbienceEmitter());
// Query for ambience emitters inside a SystemBase
public partial class AmbienceProcessingSystem : SystemBase
{
protected override void OnUpdate()
{
// Example: iterate over all entities with AmbienceEmitter
Entities
.WithAll<Game.Creatures.AmbienceEmitter>()
.ForEach((Entity e) =>
{
// Perform ambience-related processing here
})
.Schedule();
}
}
Additional notes: - The StructLayout(Size = 1) attribute forces a one-byte size for this empty struct which is useful for compact serialization and stable layout when interacting with low-level systems. - Use this component as a marker only — store any per-emitter data in other components if needed (e.g., sound ID, radius, attenuation).