IAudioGenerator
Factory for instantiating GeneratorInstance to be used internally or from other scripts.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Interface
- Namespace: UnityEngine.Audio
- Assembly: UnityEngine.AudioModule
public interface IAudioGenerator : GeneratorInstance.ICapabilities
Remarks
IAudioGenerators do not own any created GeneratorInstance instances, nor should they try to store these for scripting. Instead, the user of the IAudioGenerator should expose the created GeneratorInstance through their own API.
IAudioGenerators are generally implemented on a MonoBehaviour or a ScriptableObject to bind together asset/scene management and audio generation tools with a uniform interface. You can also directly instantiate a GeneratorInstance using a ControlContext purely in code.
If you want to serialize a reference to a IAudioGenerator and have an object picker for asset / component based factories, use the IAudioGenerator.Serializable utility to store/load these references.
Additional Resources: AudioSource.generator, AudioSource.generatorInstance
Methods
Method | Description |
|---|---|
| CreateInstance | Ask this interface to create a GeneratorInstance. |
Structs
Struct | Description |
|---|---|
| IAudioGenerator.Serializable | A helper struct that allows you to object select and serialize a reference to any Object, MonoBehaviour or ScriptableObject that implements IAudioGenerator. |