- Home /
Putting a UnityEvent PropertyDrawer into a Custom Editor Window
I'm attempting to build a custom window interface for my GameEvents so that I can define all my data and keep them in .asset files rather than separate .prefab files. However, I've hit a snag: Creating a property drawer for the UnityEvents. [cont. after the image]
As you can see in the image above, part of this editor's function is building a list of buttons with UnityEvents I define in this window. This will allow me to make truly modular interfaces which will save a tremendous amount of time and add a lot of flexibility with this game. That is, after I figure out how to inject that data into the buttons.
First comes first, though: I need to know how to generate a PropertyDrawer that works like Unity's Inspector with button OnClick() events. The UnityEvents are being stored in a List for later use and I'm open to any suggestions on how to accomplish storing/modifying their data (property-drawers, serialized-property, etc).
Any help in figuring this out would be appreciated. My responses should be fast as I work from home if there are questions you'd like to ask so that you can better help me.
Answer by uglycomputer · Jun 25, 2018 at 03:40 AM
Any reason you can't make Unity draw the default drawer for that property?
EditorGUI.PropertyField(rect, eventProperty)