SFX

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.

string name#

The name of this SFX when instantiated.

Transform parent#

The transform to set the instantiated SFX clip’s parent as.

Useful for orginization purposes.