-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some Unity struct types do now allow edit-time modification #66
Comments
There's still a couple of issues that I've confirmed aren't related to #68 There's a bit of a gap between the reference button and the following field |
Padding
The gap is related to the fix for the bug with that popup style mentioned here #57 (comment). Essentially when in a list that Popup button is being obscured by the propertyfield next to it which is somehow extending past the beginning of its rect (internal to Unity, our calculations seem fine), thus rendering it unclickable. I mitigated this issue by giving the popup button a width that includes its own width + buffer for the indent level. This results in there being a slight margin between the end of the rect for the popup and propertyfield, but allows the popup to remain clickable whether in a list or as a single field. I've added some screenshots here showing a pink box for the constant/variable propertyfield and how it interferes with the popup button, with and without the fix. This behavior is something internal to the EditorGUI controls for vector fields which we likely are not going to be able to fix easily. One possible solution is to write our own EditorGUI Vector field methods which would allow us to more tightly control the spacing and avoid any blackbox behavior from the default Unity Vector field controls. Overall the impact of this padding as a bug seems low to me, but could be mitigated with more custom editor code for these value types. Constant Values on Next LineLatest screenshot off of master for constant value drawers The only time where I see constant values being placed onto the next line is where the inspector width has become small enough that the controls are not editable and being placed there. I tried some fixes to see what it would look like when it was forced to a single line, but this seems to cause a worse readability issue than symptom its trying to fix. With fix to set single line always (less readable): Current behavior where constant is pushed to next line with small inspector width (more readable): |
I created a PR here that adds a Debug GUIStyle as well as some unrelated refactoring I did while testing this. If you feel like poking at this just add |
Nice job! Looks great |
Summary
There is currently a bug with the Inspector/Drawers for editing Reference constant, variable, or collections of Vector4 and Quaternion where only a foldout is shown with no editable fields (tested on 2019.1.0f2).
I have resolved this drawing issue by adding some hardcoded checks to
GenericPropertyDrawer
(for layout and non-layout methods) to check for these types and show the appropriate controls and changing theBaseReferenceDrawer
to use this helper class, but the work is based on PRs #57 and #65 so I would wait until those are merged prior to making another PR.Before
Vector4Variable
QuaternionCollection
Example script with various references
After
Vector4Variable
QuaternionCollection
Example script with various references
The text was updated successfully, but these errors were encountered: