AudioPreset
Namespace: BP.Audipool
Type: struct(sealed, ScriptableObject)
A reusable, asset-based container for audio configuration. AudioPreset wraps an internal AudioSourceData instance and exposes methods to copy from or apply settings to a Unity AudioSource.
Tone assets are intended for authoring audio presets in the editor and reusing them consistently at runtime.
Description
AudioPreset allows audio configuration to be stored as a Unity asset rather than constructed at runtime. This makes it suitable for:
- Designer-authored audio presets
- Consistent configuration across multiple sounds
- Integration with
AudioHandle.WithAsset(...)
Internally, the asset delegates all behavior to an AudioSourceData instance.
Methods
CopyFromSource(AudioSource source)
public void CopyFromSource(AudioSource source)Copies all supported audio-related properties from the given AudioSource into the internal AudioSourceData instance.
- Logs an error if
sourceis null
ApplyToSource(AudioSource source)
public void ApplyToSource(AudioSource source)Applies the stored audio configuration to the given AudioSource.
- Logs an error if
sourceis null - Overwrites all relevant
AudioSourceparameters
Usage Examples
Creating a Tone Asset
Create a new asset via the Unity menu:
Assets → Create → Audipool → AudioPresetCapturing Settings from an AudioSource
AudioPreset.CopyFromSource(audioSource);Playing Audio with a AudioPreset
Audipool.Get()
.WithAsset(AudioPreset)
.Play();