Click or drag to resize

AudioSourceExtSafePlay Method

Convenience wrapper around AudioSource.Play.

Namespace:  RavingBots.MagicGestures.Utils
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static void SafePlay(
	this AudioSource audioSource,
	AudioClip clip = null,
	float volume = -1f,
	float pitch = -1f,
	bool onlyIfLouder = false
)

Parameters

audioSource
Type: AudioSource
clip (Optional)
Type: AudioClip
volume (Optional)
Type: SystemSingle
pitch (Optional)
Type: SystemSingle
onlyIfLouder (Optional)
Type: SystemBoolean

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type AudioSource. 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).
Remarks
This method can optionally set a new clip, volume and pitch before calling Play. It will also behave correctly when the clip is already playing, or when the AudioSource is .
See Also