IAudioEffect
Factory for instantiating EffectInstance to be used internally or from other scripts.
Read time 1 minuteLast updated 2 days ago
Definition
- Type: Interface
- Namespace: UnityEngine.Audio
- Assembly: UnityEngine.AudioModule
public interface IAudioEffect : EffectInstance.ICapabilities
Remarks
Implement IAudioEffect on a MonoBehaviour and add the component to the same GameObject as an AudioSource to process the audio source's signal with the effect. The audio source discovers the component automatically, calls IAudioEffect.CreateInstance, and owns the returned EffectInstance. Use AudioSource.GetEffectInstance to interact with the instance while it is playing.
IAudioEffects do not own any created EffectInstance instances, and they don't try to store these for scripting.
If you want to serialize a reference to a IAudioEffect, use the IAudioEffect.Serializable utility to store/load these references.
Additional Resources: AudioSource.GetEffectInstance, ControlContext.AllocateEffect
Methods
Method | Description |
|---|---|
| CreateInstance | Ask this interface to create an EffectInstance. |
Structs
Struct | Description |
|---|---|
| IAudioEffect.Serializable | A helper struct that allows you to serialize a reference to any Object, MonoBehaviour or ScriptableObject that implements IAudioEffect. |