Is there a way to template structures in 2023?

I have read some old posts in this forum (from several years ago). I know templating classes and structs was not possible in 2016…

How is it in 2023? Can something be done now?

I need to do something like this…


Is there any alternative?

Thank you so much!!

Not really, but you may be able to get somewhere close by tricking UHT and wrapping things in #if CPP ... #endif Blocks. The engine uses these in a couple of places as well to handle some of the common aspects of such structs.
In your case you may need to remove the UPROPERTY macro and then handle garbage collection by implementing AddReferencedObjects. And you’d obviously lose the EditDefaultsOnly support and have to implement a custom property editor.

1 Like

Ok, I will study this alternative.
Thank you very much for your help!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.