Hi Kamrann,
We seem to use TUnion in only one place: PhysXCollision.h.
TUnion has some issues - like a limit of 6 types, poor (zero) compile-time handling of repeated types and no assignment operator. I would like us to have a proper TVariant some day, though it seems there is little demand for it right now.
For now, I would recommend that you use boost::variant with the following caveat: it may or may not be trivially relocatable, which all UE4 types are expected to be. This means that you could have trouble mixing Boost types and UE4 types - particularly our containers, i.e.:
TArray<FTypeContainingABoostVariant> DisasterWaitingToHappen;
If this is a problem for you, you could wrap your variant in a TUniqueObj as a workaround:
struct FTypeContainingABoostVariant
{
TUniqueObj<boost::variant<FTypeA, FTypeB, FTypeC>> Variant;
};
Hope this helps,
Steve