Support for vector of unions

202 views
Skip to first unread message

Even Braudaway

unread,
Apr 15, 2015, 4:12:24 AM4/15/15
to flatb...@googlegroups.com
I was curious if there are plans to support it and how difficult the implementation would be? I'm working on generating a C# layer that sits between my game editor and the flatbuffer generated C# code. It provides mutable versions of the classes and a simple API for reading/writing them to flatbuffers, using the underlying flatbuffer generated classes. Generating code to support unions like below is a bit clumsy and I find myself wanting either a specialized table type that wraps a union field and nothing else or support for vectors of unions.

union UComponent { CompA, CompB }
table Component  { comp:UComponent }
table Entity     { comps:[Component] }

Wouter van Oortmerssen

unread,
Apr 15, 2015, 12:52:08 PM4/15/15
to Even Braudaway, flatb...@googlegroups.com
We're aware that this use-case is clumsy, but properly fixing it (such that a union could appear anywhere) has big consequences for forwards/backwards compatibility, so I don't see an easy way to do this any time soon.

Certainly the way you've done it is the best way for now.

--
You received this message because you are subscribed to the Google Groups "FlatBuffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages