Rename the attribute to ClearsToDefaultAttribute and also allow setting non-reference types (see [RequiresBehaviourState] for the logic to set to default).
Add a new attribute ClearsByMethodAttribute which takes the nameof the method to call on the property to clear it. This needs to handle null property values(!), and shall ensure the method exists on the property's type(!) and the method is accessible(!) and takes no arguments(!). The method's return value shall be ignored.
ClearsToDefaultAttribute
and also allow setting non-reference types (see[RequiresBehaviourState]
for the logic to set todefault
).ClearsByMethodAttribute
which takes thenameof
the method to call on the property to clear it. This needs to handlenull
property values(!), and shall ensure the method exists on the property's type(!) and the method is accessible(!) and takes no arguments(!). The method's return value shall be ignored.