The receiver casts EventArgs to the expected derived type and handles the data.
Is there a way to do this where EventArgs is instead a struct? I’m naive, so excuse me if I’m mistaken, but structs are significantly less overhead (and are better for garbage collection?) than UObjects right?
I’m creating a lot of UObjects this way. Sometimes thousands in a single frame. I’ve tried using structs where FEventArgs has derived FMySpecificEventArgs containing the params needed, but I can’t pass it as an FEventArgs* and cast to FMySpecificEventArgs* in the receiving function.
Is there some way to be polymorphic with UStructs?
I think I found a solution using StructUtils / FInstancedStruct. I would appreciate any knowledgeable person’s advice if this is actually better than just sending UObjects as EventArgs.