Click or drag to resize

ExtensionMethodsPlayOneShot Method

Plays an array of AudioSources one time (without looping).

Namespace:  DustProductions.Core
Assembly:  DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public static void PlayOneShot(
	this AudioSource[] audioSources,
	AudioClip customClip = null,
	float normalizedVolume = 1f
)

Parameters

audioSources
Type: AudioSource
The array of audio sources that will be played once.
customClip (Optional)
Type: AudioClip
If we want all of these sources to play a single clip, we can pass that in here. If this is not assigned, the clip already on the AudioSource will be used.
normalizedVolume (Optional)
Type: SystemSingle
The volume from 0 to 1 (inclusive) we will play the clip at. Defaults to 1.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also