Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AudioClip

Namespace: UnityEngine

/

Inherits from: Object

Description

A container for audio data.

An AudioClip stores the audio file either compressed as ogg vorbis or uncompressed. AudioClips are referenced and used by AudioSources to play sounds.

See Also: AudioClip component in the Components Reference.

Variables

channelsChannels in audio clip. (Read Only)
frequencySample frequency. (Read Only)
isReadyToPlayIs a streamed audio clip ready to play? (Read Only)
lengthThe length of the audio clip in seconds. (Read Only)
samplesThe length of the audio clip in samples. (Read Only)

Functions

GetDataFills an array with sample data from the clip.
SetDataSet sample data in a clip.

Static Functions

CreateCreates a user AudioClip with a name and with the given length in samples, channels and frequency.

Inherited members

Variables

hideFlagsShould the object be hidden, saved with the scene or modifiable by the user?
nameThe name of the object.

Functions

GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the game object.

Static Functions

DestroyRemoves a gameobject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadMakes the object target not be destroyed automatically when loading a new scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateClones the object original and returns the clone.

Operators

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares if two objects refer to the same.