Firstly, this isn't related to TNet, but since TNet has incredible serialization I figured it wouldn't hurt to post it here.
I have a UIContainer with a public List<IDisplayable> ObservedData field.
Unity Editor doesn't serialize interfaces, so this field doesn't show up on the Inspector.
I'd like to fix this. I'm currently using a custom inspector. Accepting a GameObject as input, I then use reflection to iterate over all MonoBehaviour's and their fields (and the fields fields) to build a List<string> of typenames and fieldnames which I can then display in a popup.
The MonoBehaviour, string typeName, and string fieldName are stored on the UIContainer. In Start() I use reflection to (finally) grab the reference.
This is horrible and I hate it. Is there a better way of doing this? The ObservedData on the UIContainer won't ever be modified; it's only ever read. Additionally, I'd like to support assigning references that aren't implicitly List<IDisplayable> but can be cast without resulting in a new instance. For example, setting UIInventoryContainer's ObservedData to PlayerInventory.Items (which is List<IPickupable> [IPickupable derives from IDisplayable]), any changes made to PlayerInventory.Items will be reflected in ObservedData.