







![]() |
ClockStone Audio Toolkit for Unity - Documentation |
AudioController..::..PlayMusic Method (String, Single, Single, Single) |
AudioController Class See Also Send Feedback |
![]() |
Plays an audio item with the name audioID as music.
Namespace: (Default Namespace)
Assembly: AudioToolkit (in AudioToolkit.dll) Version: 8.0.0.0 (8.0.0.0)
Syntax
C# |
---|
public static AudioObject PlayMusic( string audioID, float volume = 1f, float delay = 0f, float startTime = 0f ) |
Parameters
- audioID
- Type: System..::..String
The audio ID.
- volume (Optional)
- Type: System..::..Single
The volume betweeen 0 and 1 [default=1].
- delay (Optional)
- Type: System..::..Single
The delay [default=0].
- startTime (Optional)
- Type: System..::..Single
The start time [default=0]
Return Value
Type: AudioObjectReturns the reference of the AudioObject that is used to play the audio item, or null if the audioID does not exist. Warning: Use PoolableReference<(Of <(<'T>)>)> to store an AudioObject reference if you have pooling enabled.
Remarks
PlayMusic makes sure that only one music track is played at a time. If music cross fading is enabled in the AudioController
fading is performed automatically.
The audio clip the object will be placed right in front of the current audio listener which is usually on the main camera. Note that the audio object will not be parented - so you will hear when the audio listener moves.
The audio clip the object will be placed right in front of the current audio listener which is usually on the main camera. Note that the audio object will not be parented - so you will hear when the audio listener moves.