Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetEffectInstance<TComponent>(TComponent)

Gets a handle to the effect instantiated from a specific IAudioEffect component attached to this AudioSource 's GameObject.
Read time 1 minuteLast updated 16 hours ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.AudioModule

GetEffectInstance<T>(T)

public ProcessorInstance GetEffectInstance<TComponent>(TComponent effectComponent) where TComponent : Component, IAudioEffect

Parameters

effectComponent

T
Component implementing IAudioEffect on the same GameObject as this AudioSource.

Returns

Type

Description

ProcessorInstanceThe ProcessorInstance for the effect, or a default-initialized instance if the component has no instantiated effect.

Remarks

Use this for runtime scripting control of an attached effect while it is playing, for example to send messages with ControlContext.SendMessage. Since the AudioSource owns the instance, check for its existence using ControlContext.Exists.