Game.Prefabs.AudioSpotData
Assembly: Assembly-CSharp (inferred)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Summary:
AudioSpotData is a lightweight ECS component (IComponentData) used to store interval information for an audio "spot" (an entity that can play sounds). It contains a single float2 field (Unity.Mathematics) that typically encodes interval values (for example a min/max or start/end pair) used by audio systems to schedule or randomize playback timing. Because it also implements IQueryTypeParameter it is intended to be used directly in ECS queries/ForEach operations.
Fields
public float2 m_Interval
Stores interval values as a float2 (X and Y). Common usage is to treat X and Y as a min/max interval in seconds or as two related timing parameters. Exact semantics depend on the audio system that consumes this component.
Properties
- (none)
Constructors
- (default value-type constructor)
Struct uses the default generated constructor. Initialize fields explicitly when adding this component to an entity (see usage).
Methods
- (none)
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;
// Adding to an entity (EntityManager API)
var audioSpot = new AudioSpotData { m_Interval = new float2(1.0f, 3.0f) }; // e.g. min=1s, max=3s
entityManager.AddComponentData(entity, audioSpot);
// Reading in a system (example pseudo-code; adapt to your ECS version)
Entities.ForEach((ref AudioSpotData audio) =>
{
float minInterval = audio.m_Interval.x;
float maxInterval = audio.m_Interval.y;
// use min/max to schedule or randomize playback timing
}).ScheduleParallel();
Additional notes: - float2 is provided by Unity.Mathematics; include that namespace when constructing the component. - This component contains only data. Any behavior (scheduling, playing audio) is implemented by systems that read this component. - When modding, follow the game's conversion/authoring workflow if you need this data to be set up from authoring GameObjects/prefabs.