SFX#
- NAMESPACE:
UnityUtils.ScriptUtils.Audio
The SFX class is used to easily play sound effects in turn with SFXManager.
Example Usage#
using UnityEngine;
using UnityUtils.ScriptUtils.Audio;
public class ExampleScript : MonoBehaviour
{
public SFX sfxClip = SFX.Create2dSFX(); // Creates a new SFX clip with some default parameters for a 2d SFX
public SFX musicClips = SFX.Create3dSFX(); // Creates a new SFX clip with some default parameters for Music clips
void Start()
{
// Play basic SFX
SfxManager.PlaySFX(sfxClip);
}
}
Functions#
- UnityUtils.ScriptUtils.Audio.SFX
Used in SFXManager to play audio clips with some set parameters.
Public Functions
-
bool HasAudioClips()#
Checks if this SFX has any audioClips to play.
Public Members
- AudioClip[] audioClips
Randomly play one of these clips when this SFX is played.
Only set 1 AudioClip if you do not want to randomize the clips
-
AudioSource audioSource#
If null, will create a new object and add an audio source. Otherwise will play on the set audio source.
-
SFXVolumeSettings volumeSettings#
The volume settings used when playing this SFX. See SFXVolumeSettings for more info.
-
SFXPitchSettings pitchSettings#
The pitch settings used when playing this SFX. See SFXPitchSettings for more info.
-
SFX3dSettings spacialSettings#
The 3d settings used when playing this SFX. See SFX3dSettings for more info.
-
SFXDestructionSettings destructionSettings#
The destruction settings used when playing this SFX. See SFXDestructionSettings for more info.
Public Static Functions
-
SFX Create2dSFX()#
Returns a new SFX with the following properties:
- SFXVolumeSettings.volume = 1
- SFXVolumeSettings.volumeType = AudioManager.VolumeType.SFX
- SFXPitchSettings.pitch = 1
- SFXPitchSettings.pitchVariance = AudioManager.DEFAULT_PITCH_VARIANCE
- SFX3dSettings.localPosition = Vector3.zero
- SFX3dSettings.spacialBlend = 0
- name = “2D SFX [UnityUtils.ScriptUtils.Audio]”
-
SFX Create3dSFX()#
Returns a new SFX with the following properties:
- SFXVolumeSettings.volume = 1
- SFXVolumeSettings.volumeType = AudioManager.VolumeType.SFX
- SFXPitchSettings.pitch = 1
- SFXPitchSettings.pitchVariance = AudioManager.DEFAULT_PITCH_VARIANCE
- SFX3dSettings.localPosition = Vector3.zero
- SFX3dSettings.spacialBlend = 1
- name = “3D SFX [UnityUtils.ScriptUtils.Audio]”
-
bool HasAudioClips()#