Struct AudioSource
An AudioSource component plays back one audio clip at a time.
Namespace: Unity.Tiny.Audio
Syntax
public struct AudioSource : IComponentData
Remarks
Multiple audio sources can play at the same time. To start playback use the AudioSourceStart component. To stop playback use the AudioSourceStop component.
clip
, volume
, and loop
are read when the audio source
starts as a result of AudioSourceStart being added. They will
not change audio that is already playing.
isPlaying
is updated with every tick of the world.
Fields
clip
Specifies the audio clip that plays when this source starts playing.
Declaration
[EntityWithComponents(new Type[]{typeof(AudioClip)})]
public Entity clip
Field Value
Type | Description |
---|---|
Entity |
loop
If true, replays the audio clip when it reaches end.
Declaration
public bool loop
Field Value
Type | Description |
---|---|
System.Boolean |
volume
Specifies the audio clip's playback volume. Values can range from 0..1.
Declaration
public float volume
Field Value
Type | Description |
---|---|
System.Single |
Properties
isPlaying
True if the audio clip is currently playing.
Declaration
public bool isPlaying { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
isPlaying
will start false, and will be false until the AudioSourceStart tag
is removed by the Audio system.