- Home /
Making a custom popup for data objects: Can I use the PropertyDrawer to change the object itself?
Hi,
I have a few cases of a class that's used to make a list of central data objects that can be used anywhere, saved into XML, and loaded. These are things like Nations: Egypt, Babylonia, Persia ... and Resources: Gold, Wood, Cheese ... These objects can be accessed from a singleton.
I want to make a custom Inspector display that allows a variable of one of these types to be assigned a value via a popup dropdown. e.g. If a boat belongs to a certain nation, it has a 'nation' variable, which I want to be able to set by a dropdown which shows all the nations that are stored in the singleton.
I'm trying to use the PropertyDrawer for this, but it doesn't seem to be able to edit a class object itself; only member variables of that object. But I don't want to change the treasury or army size of the nation that a boat belongs to: I want to be able to set the nation itself.
How can I do this?