Heya, I’m having trouble getting bound elements to update their name, nothing I do seems to matter.
I threw together a script to do… well basically anything I could think of to get the name to update, however it will not update the name until I close the window and open it again, despite the asset being successfully renamed in the editor.
Since the actual value of “property” does not change, the bound ObjectField is not updated. We seem to not be tracking the “name” when we check for changes in our bindings code.
A couple of things to note:
verify that the asset reference you get back from your ImportAsset() is still the exact same instance (via instanceId) as your current property.objectReferenceValue
all the MarkDirtyRepaint(), Update() and ApplyModifiedProperties() calls are redundant, because you haven’t actually changed the serializedObject in any way. You’ve changed a property on an object the serializedObject is referencing (one step removed)
try just changing the name on the objectReferenceValue without the re-import and asset db change
worst case, call Unbind() and Bind() on the container element containing your object PropertyFields (or ObjectFields)
Behaves essentially the same way, except of course the asset file’s name stays the same. It does reflect the name change in the property, but only after clicking on a different object and letting the inspector rebuild.
Bind and unbind also behave the same way, using these as trials they behave exactly the same as above.