How to Serialize custom template class

Hi!
I have written myself a few generic classes / structs that use C++ templates, I usually have to make a wrapper class for each type I want exposed to the editor and have alot of operator overloads etc… And in general it is not that nice to work with it.

I know that serializing template classes is absolutely possible. For example TArray, TSubclassOf, TScriptInterface etc… are all fully supporting serialization with all supported types (pointers + primitive types or UE known types like int, float and FVector, FRotator).

So my desire is to create a serializable template class that can be serialized and noticed with the reflection using UPROPERTY() and have possibly even blueprint exposable functions ideally.

Is there some guidline already created to do this? Does someone know how to do this or what part of the code do I need to use to add serializing for my custom template classes? Any help on this topic would be super useful, if no help is found I am planning to do some code adventures to explore this.

2 Likes