KMAudio - Qkrisi/ktanemodkit GitHub Wiki
KMAudio
[DisallowMultipleComponent]
public class KMAudio : MonoBehaviour
Provides an interface to the game's audio system. Allows playing of sounds in a way that will respect volume settings and gameplay events. Can be used to play existing sounds or sounds added in this mod.
To add sounds to the mod, assign the mod.bundle
bundle name to the sound files as well!
public void PlaySoundAtTransform(string name, Transform transform)
Play a sound from this mod at the given transform.
The name of the sound should not include its extension!
public void PlayGameSoundAtTransform(KMSoundOverride.SoundEffect sound, Transform transform)
Play an existing game sound (or its override) at the given transform.
public KMAudioRef PlaySoundAtTransformWithRef(string name, Transform transform)
Play a sound from this mod at the given transform. The sound will loop until the StopSound
delegate of the returned KMAudioRef
is called.
The name of the sound should not include its extension!
public KMAudioRef PlayGameSoundAtTransformWithRef(KMSoundOverride.SoundEffect sound, Transform transform)
Play an existing game sound (or its override) at the given transform.
KMAudio.KMAudioRef
This class can be used to stop a playing sound.
public Action StopSound;
Delegate to stop the playing sound.