Game.Prefabs.AmbientAudioSettingsData
Assembly: Game
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
Represents ambient audio placement / blending parameters for a prefab in the ECS world. This plain IComponentData stores height bounds and distance/overlap ratios that systems can use to determine when and how to spawn or mix ambient audio sources (for example, determining valid height range for ambient sounds, how much different audio regions overlap, and minimum distance scaling). Because it implements IQueryTypeParameter it can be used directly in EntityQuery/ForEach signatures.
Fields
-
public float m_MinHeight
Minimum height (world Y) where the ambient audio applies. Systems use this to filter or clamp placement to a lower altitude bound. -
public float m_MaxHeight
Maximum height (world Y) where the ambient audio applies. Systems use this to filter or clamp placement to an upper altitude bound. -
public float m_OverlapRatio
Controls how much ambient audio areas can overlap each other. Typical range [0..1], where 0 means no overlap and 1 allows full overlap. Exact interpretation depends on the consuming system. -
public float m_MinDistanceRatio
A multiplier or ratio used to compute minimum allowed distances between ambient audio sources (e.g., scaling the base distance). Typical range [0..1+] depending on desired spacing behavior.
Properties
- (none)
This struct exposes only public fields. No C# properties are defined.
Constructors
- (default)
No explicit constructors are defined. The default parameterless constructor (all floats initialized to 0) is available. Initialize values via object initializer or by assigning fields after construction.
Methods
- (none)
This type contains no methods. It is plain data intended for use with Unity.Entities APIs.
Usage Example
// Create and assign the component to an entity
var audioSettings = new AmbientAudioSettingsData {
m_MinHeight = 0f,
m_MaxHeight = 120f,
m_OverlapRatio = 0.2f,
m_MinDistanceRatio = 0.5f
};
entityManager.AddComponentData(entity, audioSettings);
// Example of reading it in a system
Entities.ForEach((in AmbientAudioSettingsData settings, in Translation pos) => {
if (pos.Value.y >= settings.m_MinHeight && pos.Value.y <= settings.m_MaxHeight) {
// Apply ambient audio logic here, using settings.m_OverlapRatio and settings.m_MinDistanceRatio
}
}).Schedule();