I have a custom inspector for a bunch of scriptable objects.
The scriptable objects are programmed to be reactive via public properties.
Some of the Getters are calculated on the fly and have no backing variables.
Some Setters must be validated before assignment in order to avoid recursion and never ending loops for example.
Some Setters modify values of other fields and call functions when they are changed.
Some Setters register or de-register to event delegates.
How am I supposed to “emulate” this behaviour and meet asset store requirements with Serialized Properties when public properties cannot be used?
Thanks
What are those requirements, and where did you see them? I would think as long as your asset works as intended, everything is serialized correctly and undo/redo works as expected then it should be fine?
So, I decided to test implementing Undo/Redo manually.
When an Undo/Redo event occurs though, the change doesn’t go through the public properties like the inspector input does.
There is also no real information about what was undone/redone.
This basically means that when Undo/Redo occurs, I need to re-validate everything. unhook/rehook all events on all of my objects etc because I don’t know what has changed and what action to take.
So I have to design it almost like it is stateless, but only for the inspector…
If I’m going to do that, I might as well use Serialized properties, and bypass public properties for the custom inspector.
The problem is, I will still want public properties for when the user is making changes at runtime via code.
So, do I handle the privates directly via custom inspector, and then use public properties for runtime access, and try to maintain these two different code paths? Seems messy.