Skip to content

Game.Prefabs.AudioGroupingSettingsData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
AudioGroupingSettingsData is a plain data buffer element used by the game's ECS to describe grouping and ambiences for audio associated with a prefab. Each element encodes how an audio group behaves with height, fade/scaling parameters and references to near/far sound entities. It's intended to be stored in a DynamicBuffer on a prefab or entity so multiple grouping entries can be attached.


Fields

  • public GroupAmbienceType m_Type
    Specifies the ambience/grouping type for this entry. GroupAmbienceType is an enum (not shown in this file) that the audio systems use to categorize or select ambient sounds.

  • public float2 m_Height
    A float2 (Unity.Mathematics) that represents a height range or related height parameters used by the audio grouping logic (for example min/max heights where this grouping applies).

  • public float m_FadeSpeed
    Speed at which transitions/fades happen when switching to this grouping (used by audio blending/attenuation logic).

  • public float m_Scale
    A multiplier applied to volume/attenuation or other audio parameters for this group.

  • public Entity m_GroupSoundNear
    An ECS Entity reference to the "near" group sound (usually a sound prefab or audio resource entity used when listener is near the source).

  • public Entity m_GroupSoundFar
    An ECS Entity reference to the "far" group sound (used when listener is far from the source or for distant ambient sounds).

  • public float2 m_NearHeight
    A float2 specifying a height range or parameters used specifically for the near sound selection/blending.

  • public float m_NearWeight
    Weight factor used when blending between near and far group sounds (higher values favor the near sound).

Properties

  • None — this type exposes only public fields and implements IBufferElementData. There are no C# properties defined in the source.

Constructors

  • public AudioGroupingSettingsData()
    Only the implicit parameterless struct constructor is available in the source. Fields will have their default values unless explicitly initialized when adding entries to a buffer.

Methods

  • None — no methods are defined on this struct.

Usage Example

// Example: adding an AudioGroupingSettingsData entry to a prefab/entity using the EntityManager
// (Requires using Unity.Entities and Unity.Mathematics)

Entity prefabEntity = /* obtain or create your prefab entity */;
Entity nearSoundEntity = /* entity that holds the 'near' sound */;
Entity farSoundEntity = /* entity that holds the 'far' sound */;

// Ensure the buffer exists on the entity (adds it if not present)
var buffer = EntityManager.GetBuffer<AudioGroupingSettingsData>(prefabEntity);

// Add a new grouping entry
buffer.Add(new AudioGroupingSettingsData {
    m_Type = GroupAmbienceType.Exterior,            // replace with a valid enum value
    m_Height = new float2(0f, 20f),                 // example height range
    m_FadeSpeed = 1.0f,
    m_Scale = 1.0f,
    m_GroupSoundNear = nearSoundEntity,
    m_GroupSoundFar = farSoundEntity,
    m_NearHeight = new float2(0f, 8f),
    m_NearWeight = 0.75f
});

Notes: - This struct is intended as pure data for ECS audio systems — audio behavior is implemented elsewhere (systems that read this buffer and drive audio playback/parameters). - Replace GroupAmbienceType.Exterior with the appropriate enum member defined in your project.