With two or more plug-in instances active in an AudioMixer (e.g. in two Groups), the Custom GUI won't reflect the plug-in parameter's state after a parameter has been set via the Custom GUI's script. It only shows the last set value independent of the plug-in instance.
In code words:
after calling
plugin.SetFloatParameter("parameterName", value);
in IAudioEffectPluginGUI's OnGUI(IAudioEffectPlugin plugin) method,
plugin.GetFloatParameter("parameterName", out float value);
always returns the value which was set most recently, independent on which plugin instance is currently selected.
Steps to reproduce
Clone / download the latest version of this repository
build the project in NativeCode
create a new Unity project
import the binary (e.g. AudioPluginDemo.bundle on macOS) into the projects (assets)
also import EqualizerCustomGUI.cs, GUIHelpers.cs, MathHelpers.cs from GUICode/AudioPluginDemoGUI
create an AudioMixer
create a new Group
add the Demo Equalizer plugin in both groups (Master and the new one)
move the sliders of LowFreq, MidFreq, and HighFreq in one of the instances (only sliders, NOT the editor)
switch back and forth between both plugins and verify that the state updates accordingly
move one of the vertical bars (black, grey, white) of one instances, see how the corresponding frequency slider changes (expected behaviour)
again: switch back and forth between the plugins, see that the rendered GUI won't update any more although the Horizontal Sliders do
I don't think this is a bug of this repository, but rather one in Unity itself. Or is there something you can do in the scripts to prevent this from happening?
This behaviour renders the CustomGUI feature unusable if the GUI is used to change parameter values and not only displays them (like in all the UI examples in this repository).
Summary
With two or more plug-in instances active in an AudioMixer (e.g. in two Groups), the Custom GUI won't reflect the plug-in parameter's state after a parameter has been set via the Custom GUI's script. It only shows the last set value independent of the plug-in instance.
In code words:
after calling
in
IAudioEffectPluginGUI
'sOnGUI(IAudioEffectPlugin plugin)
method,always returns the value which was set most recently, independent on which plugin instance is currently selected.
Steps to reproduce
NativeCode
AudioPluginDemo.bundle
on macOS) into the projects (assets)EqualizerCustomGUI.cs
,GUIHelpers.cs
,MathHelpers.cs
fromGUICode/AudioPluginDemoGUI
I don't think this is a bug of this repository, but rather one in Unity itself. Or is there something you can do in the scripts to prevent this from happening?
This behaviour renders the CustomGUI feature unusable if the GUI is used to change parameter values and not only displays them (like in all the UI examples in this repository).