Prior to writing a small script for planning children's shoes, in order for them to use it quickly understand the usage, customize the editor, rewrite the script's Inspector panel layout and display logic.
But the problem is that once the custom Editor,gizmo drawing contains parameters that are assigned by the editor, it cannot be used. That is, if I want gizmos.drawline (from * param, to * param), where Param assigns a parameter to the editor, the Gizmo will always use the default value. I think it is also very well understood that the extension of the thing Gizmo is of course not known. So Google a bit, after several twists and turns (mainly did not find the same as my problem, but found their own handle Gizmo method). The final resolution version is as follows:
1 [Drawgizmo (gizmotype.selected | Gizmotype.selectedorchild)]2privatestaticvoid Handlemygizmo ( Transform Atransform, Gizmotype atype) {3 // at this time, you can do whatever you want! 4 // can get other editor-assigned serialization properties for gizmos5 // But it's important to note that this approach is global and needs to be tested for your specific script 6 }
The effect is good, just need to select the object will be displayed, of course, there are children shoes can also add gizmotype.notselected achieve and gizmos the same effect
Resolves an issue where gizmos cannot be displayed with the Inspector panel assignment as a parameter in the custom editor