Reflection Tricks

So, I was having trouble with digging into arrays with reflection, but I solved it

    public AudioMixer AudMix;

    void Start () {

        Array value = (Array)AudMix.GetType().GetProperty("exposedParameters").GetValue(AudMix, null);

        for(int i = 0; i< value.Length; i++)
        {
            var o = value.GetValue(i);
            string Name = (string)o.GetType().GetField("name").GetValue(o);
        }
}

What type is AudioMixer?

What type is the array in AudioMixer? Is it too an internal/private type?

If not, why not cast the array that your retrieve out of ‘AudMix’ with reflection as its appropriate type so you don’t need to use reflection to get the name.

UnityEditor.Audio.ExposedParameter

Unfortunately it is not an exposed type, so I had to dig deeper.

I still don’t know what type that is.

There is no UnityEditor.Audio namespace.

There is no AudioMixer type that I know of.

Is this in some newer version of unity, like a beta or something?

It is in the UT5 beta, yeah