Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[C++] Saving TSubclassOf<> as binary

Hey guys,

I'm currently implementing a custom binary save system as explained by (the god) Rama 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 :)

Thanks in advance! Best regards, Nanoxin

Product Version: Not Selected
more ▼

asked May 13 '15 at 03:39 PM in C++ Programming

avatar image

306 35 39 44

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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*

more ▼

answered May 13 '15 at 04:53 PM

avatar image

35.2k 921 166 1098

avatar image Nanoxin May 13 '15 at 09:05 PM

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

avatar image Nanoxin May 13 '15 at 09:30 PM

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?

avatar image Nanoxin May 13 '15 at 09:39 PM

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? ;)

avatar image Shadowriver May 13 '15 at 09:51 PM

Maybe there unique infetifier that savegame use

avatar image Nanoxin May 13 '15 at 10:00 PM

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 ;) Maybe someone with more knowledge can enlighten us here, but well, I just used Names now as you suggested, thank you :)

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question