- Home /
Property Drawer Similar To AABB or Bounds?
I'd like to make a property drawer for a custom struct. The struct will have 2 float3 fields (they could be Vector3 fields if necessary). I want the struct to draw in the inspector like Unity's AABB struct or Bounds struct. My problem is that when Unity draws my struct in the inspector, it includes a dropdown arrow that you must click to unfold those 2 fields. Also, when the inspector width is decreased too much, the x, y, and z values for each field move to a new line. Unity's AABB and Bounds structs don't have dropdowns. Their fields are always displayed in the inspector. And no matter how narrow (width wise) the inspector becomes, the fields' labels and xyz values remain on the same line which is what I want for mine. I've included some screenshots to demonstrate the difference between my custom struct and Unity's AABB struct in the inspector. I'm sure I could write a Property Drawer to replicate it but it seems there should be an easier way. Does Unity provide any built in way to achieve the same result?
Here is the inspector narrow. And here is when the inspector is wide.
Your answer
Follow this Question
Related Questions
GetPropertyHeight infinite recursion on drawer 1 Answer
Adding keys to animation curve at runtime does not update the graph 0 Answers
Property Drawer and Inheritance 0 Answers
PropertyDrawer always errors when calling OnInspectorGUI 1 Answer
Why is my propertydrawer being automatically disabled? 1 Answer