Scripting API

AudioSource

class in UnityEngine · UnityEngine.AudioModule · inherits from Behaviour

43 of 57 of Unity's membersUnity's documentation
In Tassix

Plays a clip: 2D or 3D (spatialBlend), heard through the AudioListener.

Properties 28

bool bypassEffects { get; set; }
bool bypassListenerEffects { get; set; }
bool bypassReverbZones { get; set; }
AudioClip? clip { get; set; }
float dopplerLevel { get; set; }
bool ignoreListenerPause { get; set; }
bool ignoreListenerVolume { get; set; }
bool isPlaying { get; }
bool isVirtual { get; }
bool loop { get; set; }
float maxDistance { get; set; }
float minDistance { get; set; }
bool mute { get; set; }
Audio.AudioMixerGroup? outputAudioMixerGroup { get; set; }

The mixer group this source plays through (its volume and pitch apply), or null for straight to the listener.

float panStereo { get; set; }
float pitch { get; set; }
bool playOnAwake { get; set; }
int priority { get; set; }
float reverbZoneMix { get; set; }
AudioRolloffMode rolloffMode { get; set; }
float spatialBlend { get; set; }
bool spatialize { get; set; }
bool spatializePostEffects { get; set; }
float spread { get; set; }
float time { get; set; }

Seconds into the clip; 0 while stopped (Unity's reads 0 then, though timeSamples keeps a seek).

int timeSamples { get; set; }

Sample frames into the clip.

AudioVelocityUpdateMode velocityUpdateMode { get; set; }
float volume { get; set; }

Methods 14

void GetOutputData(float[] samples, int channel)
void GetSpectrumData(float[] samples, int channel, FFTWindow window)
void Pause()
void Play()
void Play(ulong delay)
static void PlayClipAtPoint(AudioClip clip, Vector3 position)
static void PlayClipAtPoint(AudioClip clip, Vector3 position, float volume)

A temporary 3D source at a point, destroyed when the clip ends.

void PlayDelayed(float delay)
void PlayOneShot(AudioClip clip)
void PlayOneShot(AudioClip clip, float volumeScale)

Plays a clip once on top of this source, scaled by volumeScale, using its settings.

void PlayScheduled(double time)

Plays at an AudioSettings.dspTime.

void SetCustomCurve(AudioSourceCurveType type, AnimationCurve curve)
void SetScheduledEndTime(double time)
void SetScheduledStartTime(double time)
void Stop()
void Stop(bool stopOneShots)
void UnPause()

Not in Tassix yet 14

DisableGamepadOutput GamepadSpeakerSupportsOutputType GetAmbisonicDecoderFloat GetSpatializerFloat PlayOnGamepad SetAmbisonicDecoderFloat SetGamepadSpeakerMixLevel SetGamepadSpeakerMixLevelDefault SetGamepadSpeakerRestrictedAudio SetSpatializerFloat gamepadSpeakerOutputType generator generatorInstance resource

Checked against Unity

Conformance scenarios that exercise it, recorded in Unity and compared event by event.