- Home /
Get RangeAttributes from built in class using Reflection
I am working on an in game GUI for editing parameters of the built in audio filters. Using reflection, I was able to get the values of these parameters, but I am struggling to get the RangeAttributes that bound these parameters in the inspector.
This is the code I have been using, however, it has only been returning null.
System.Reflection.PropertyInfo[] fields = effectType.GetProperties();
foreach(System.Reflection.PropertyInfo pi in fields){
Debug.Log(RangeAttribute.GetCustomAttribute(pi, typeof(RangeAttribute)));
}
Is it possible to retrieve these range attributes from built in classes? Am I just going about it the wrong way?
I could hand code the GUI for each filter as an alternative, but wheres the fun in that :)
The more I have looked, the less feasible it seems. The $$anonymous$$ and max range values for those variables seem to be hardcoded into the editor classes of each effect. It would be nice to be able to programmatically obtain those values for my own in game gui, but its not critical and the documentation does list the range of the values im looking for. Ill leave this question in case anyone else could benefit.
Your answer
![](https://koobas.hobune.stream/wayback/20220613103539im_/https://answers.unity.com/themes/thub/images/avi.jpg)