Download

Can save a blueprint class object?

SaveGame class is great,but I wonder if it can save somthing more than base class data?such as a group of instance constructed from a blueprint class created by myself.

Sure can. When the instances are placed in the level, you need to save their transforms in the save game. When you re-start the level, read the SG and re-place the instances.

In fact,I want to save my tree structure in blueprint with follows,but It didn’t work and I found the treeview invalid when reload the game.

Don’t use async. I know there’s a lot of youtube vids recommending it, but it’s only for special circumstances. Just use the normal nodes.

Here’s ‘save game 101’:

Thanks for ur advice,I’ve tried ur suggest and still get the same result:saving base class data is fine,but custom class data always failed…can u give some more idea?

You can’t save bare objects. You need to put the actual data in the save game yourself.

So, if you have a tree object that consists of height, variety, number of apples etc. You have an array of tree objects in the save game. When you save, for each tree, you have to write all the data to the array, not the actual object references.

If the tree was like this:

](filedata/fetch?id=1865724&d=1614168619)
Then you would save them like this:

](filedata/fetch?id=1865725&d=1614168635)
Then, we you reload the level:

Thank you sir,then I know what to do about it.