sigtrapgames / SmartData

A designer-friendly, editor-driven Unity3D framework for connecting data and events.
MIT License
271 stars 14 forks source link

Erroneous inspector serialization of array of Reader/-Writer #17

Closed Luxulicious closed 4 years ago

Luxulicious commented 5 years ago

I was hoping to keep a collection of references to several BoolVars within the same MonoBehaviour. I tried using BoolReader array for this, but it won't serialize in the inspector correctly.

For example the following code won't serialize properly in the inspector: [SerializeField] private BoolReader[] readers;

When trying to add a new item from the inspector the following error occurs: https://pastebin.com/hWH7bax5

I've tried using BoolMultiReader instead, but in my particular case I want to iterate over all the elements in the BoolMulti and haven't found a way how to yet. Since I can't reference all values in the BoolMultifrom the BoolMultiReader (to my knowledge).

Ultimately my question is, if there is a way I could iterate over the BoolMulti from a BoolMultiReader or a way to serialize an array of BoolReaders?

(My temporary fix has been referencing the BoolMulti directly)

SixWays commented 5 years ago

I'm looking into this now - I don't get the error you get, but I get a different one saying the serializedproperty has "disappeared". This seems to be a new issue - arrays of SmartRefs definitely worked before!

SixWays commented 4 years ago

This should be fixed in the latest release - please let me know if not!