







![]() |
ClockStone Audio Toolkit for Unity - Documentation |
AudioController..::..Play Method (String, Vector3, Transform, Single, Single, Single) |
AudioController Class See Also Send Feedback |
![]() |
Plays an audio item with the name audioID parented to a specified transform with a world offset.
Namespace: (Default Namespace)
Assembly: AudioToolkit (in AudioToolkit.dll) Version: 8.0.0.0 (8.0.0.0)
Syntax
C# |
---|
public static AudioObject Play( string audioID, Vector3 worldPosition, Transform parentObj, float volume, float delay = 0f, float startTime = 0f ) |
Parameters
- audioID
- Type: System..::..String
The audio ID.
- worldPosition
- Type: Vector3
The position in world coordinates.
- parentObj
- Type: Transform
The parent transform.
- volume
- Type: System..::..Single
The volume between 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.
Remarks
If the audio clip is marked as 3D the audio clip will be played at the position of the parent transform.
As the audio object will get attached to the transform, it is important to destroy the parent object using the
Destroy(GameObject) function, even if the parent object is not poolable itself