[C++] Saving TSubclassOf<> as binary

Hey guys,

I’m currently implementing a custom binary save system as explained by (the god) here : Wiki entry

I can successfully save ints now, I could do that with SaveGames as well though. I need to save special types as well, like Structs for example and I know how to accomplish that ( I guess ).
TSubclassOf however is pretty hard for me to save … How do I do that? UClass can’t be saved via << as well so I don’t really know where to go from there …

I’d be thankful for any hint / advice here :slight_smile:

Thanks in advance!
Best regards,

TSubclassOf is normal UClass pointer and pointers in C++ is integer addreses to memory which are not persistent, so only way to “save” Uclass* varable is to relate it to integer or string and in load translate to UClass*

So it is not possible to save a specific class? :confused: Meh, not what I expected, but at least I now know that isn’t possible, thank you a lot! :slight_smile:

Okay maybe I’m mistaken but I checked my code and I did that exactly with USaveGame, I saved a TSubclassOf (even an array of it!)
So there’s gotta be a way for this, right?

Maybe there unique infetifier that savegame use

I will solve this by unique FNames though probably … However I’d like to know how this could be possible to solve directly… ?
Any ideas? Anybody? :wink:

Well the savegame object is serialized as a whole thing ( I looked into the source code) with its own “context”, however when trying to do the same with a UClass this doesn’t work as its “context” doesn’t fit ? I don’t really know :wink:
Maybe someone with more knowledge can enlighten us here, but well, I just used Names now as you suggested, thank you :slight_smile: