Suppose I have a class with 10 public properties, which all happen to be floats. If I want one of them controlled by a slider, is there a code attribute I can add to do so, or do I have to write a custom editor that knows about all 10 properties and implements text boxes for nine of them and a slider for the other one?
I suspect I need a custom editor, which is unfortunate. I browsed all the answers related to "inspector", and this was the closest I found:
I believe that you are correct in your assumption that a CustomEditor is the solution. An attribute would be a great way to do this, but that's not the way the code was written. I'm surprised how few questions there are on CustomEditor, but they aren't that hard.
If you check the docs on Editor, there is a good js example of a CustomEditor - `target` is the object being inspected and it is of the type specified as the type your CustomEditor is for. To do it in another language isn't that much different. The different built-in GUI interfaces that you can use can be found in EditorGUILayout.
This isn't precisely what I want, but useful enough to call out. The DrawDefaultInspector() method does just what it says, which is useful if you want to add a control or two to the normal editor. You can add a slider for one of the 10 attributes and keep the standard textbox control as well.
If you want the default widgets available just as an "advanced" feature of your editor, this works nicely (_foldoutDefaultInspector is a bool member variable of the editor):