AudioSourceExt.PlayClipAsync Method
Asynchronous and ubiquitously plays an AudioClip.
Namespace: UltimateXR.Extensions.Unity.Audio
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0
Syntax
C#
public static Task PlayClipAsync(
AudioClip clip,
float volume = 1f,
float delay = 0f,
float pitch = 1f,
CancellationToken ct = default
)
Parameters
- clip
- Type: AudioClip
Reference to the sound clip file that will be played. - volume (Optional)
- Type: System.Single
How loud the sound is at a distance of one world unit (one meter) [0.0, 1.0]. - delay (Optional)
- Type: System.Single
Delay time specified in seconds. - pitch (Optional)
- Type: System.Single
Amount of change in pitch due to slowdown/speed up of the Audio Clip. Value 1 is normal playback speed. - ct (Optional)
- Type: System.Threading.CancellationToken
CancellationToken to stop playing.
Return Value
Remarks
This function creates an AudioSource but automatically disposes of it once the clip has finished playing.
See Also
Reference
AudioSourceExt Class
UltimateXR.Extensions.Unity.Audio Namespace