Blueprint cast support for USTRUCTs

I have a hierarchy of USTRUCTs wherein GestureBase is the parent and CircleGesture,TapGesture,SwipeGesture are all children. All the structs are declared USTRUCT(BlueprintType). Is downcasting from GestureBase to the derived structs supported, and if so, what do I need to implement to enable it? I would prefer to avoid having to convert over to UCLASS if at all possible.

Ideally what I’d like to do is be able to switch on the Type enum like in the picture below, and then cast the GestureBase class (the Gesture parameter on the NewGestureDelegate) to the appropriate derived type so that I don’t need dedicated Delegates for each subclass and can simply ‘listen in’ to all new gestures, or all stopped gesture events, etc.

In the UPROPERTY system, all Structs are stored by value, not by reference. Therefore only enough space is allocated for the specified class. Any attempt to assign a subclass in to that variable or array will result in the subclass specific data being lost, just as it would in any C++ struct usage.

If you want a pattern similar to what you’re describing you’ll either need to use UObjects or some kind of self-managed internal state to the structs where you have a base class, a type enum, and then a pointer to memory that you self manage that has the per-gesture type payload. The “Unreal Way” to accomplish something like this would be to use UObjects.