Binding to the wrong input field

Hi,

big fan of UIElements and UIBuilder :slight_smile:

Just wanted to leave this here for anyone running into the same issue:

Spent a fair amount of time trying to debug this error, which started showing up when I tried to bind nested objects / sub properties.

Assertion failed on expression: 'm_SerializedObject->m_SerializedObjectVersion == m_SerializedObjectVersion'

Turned out that it had nothing to do with binding sub properties …
I just made the mistake to use a TextField for a float property (in my subclass). Switching to a FloatField fixed the issue but I couldn’t tell from the error message.

Best,
Felix

Hi fxlange,

Could you submit a bug report with a basic example? This error is not user-friendly at all and should probably be fixed.

Thanks

I recommend trying the PropertyField element. It will generate the correct type of field (ie. TextField for string, IntegerField for int) when bound.

That said, we do have specific errors when you have mix-match object field types with UI element field types. That error was caused by something else. If you have a repro case (like, switching back to using a TextField), it would be useful for us if you submitted that as a bug using the Bug Reporter in Unity.

1 Like