Saving "Instanced Static Mesches" to SaveGame

Hi Folks,

I want to save the position and rotation of all instanced static meshes in my level as a savegame.

This is what I got done, but now I am clueless:

I have no idea how to get my transformation-arrays into the savegame.

Maybe there is a more efficient way to do this? (would it even work? I cant test it now…)

Thank you.

You need to create your save game object blueprint with the variables you want to save. When you create your save game object, select the blueprint you made under the save game class. Then set the variables in the save game var by dragging of of it and selecting the var/array you want to save.

Sorry, but i don’t understand this.

I can use normal Blueprints, but I am unable to create something without pictures. (i just cant do it)

I searched the wiki for hours, and it was useless - i can do many things with that engine, but here it comes to an end.

Could you please post a picture of what you described there?

Thank you. (really!)

PS: The whole game depends on this, everything works - expect the load/save-system. (and i did not get it to work for multiple weeks… >.<)

EDIT: I just want to save the position/rotation of every static-mesh-instance that the player placed, and load it again.

So what James94Hodges is saying is: create a new blueprint MySaveGame that inherits from SaveGame:

Add your save variables to MySaveGame, in your case an array of positions and rotations.

Then in your Create Save Game Object node, select the MySaveGame class you just created. Cast the created object to MySaveGame. Now you can modify your save variables (your positions and rotations). When you’re done, write it to disk by passing it to a Save Game to Slot node. To load the data from disk, use a Load Game from Slot node and cast to loaded object to a MySaveGame.

ok, this is what I got:

now I got stuck while loading the Data, and placing the meshes back into the level - (shouldn’t i create another array for the mesh-type while saving?)

Guys?, I still have no idea how to get the saved data back into the game.

I watched dozens of YT-Videos, and crawled the Wiki - i am absolutely clueless.

The Save-File contains Data of instanced static meshes, and I want to place them at the spot where they were when i saved the game.

Think of otherway

image save object as database record , when you save , you need spectfy its unique id from which you can backup and restore

I understand what you mean, but I don’t understand how to do this.

This is another thing that I tried. (but i am sure that there is something missing, or that it is completely wrong)

From your last image it should work. If you try printing say the location information from the transform Position for Save, is it all 0?

I have no idea how to print an Array :D, but i looked into the Log, and it said this when i tried to load:

LogArray:Warning: Attempted to get an item from array PositionsForSave out of bounds [2/1]!
LogArray:Warning: Attempted to get an item from array PositionsForSave out of bounds [2/1]!

Still unable to get it “to work” (sadly)

Can anyone tell me whats wrong? (i know that “new function 0” has no target, this is because i have no clue what is going on, and i forgot to put them together after i messed around with them)

Maybe someone can show me a working save-function for static meshes?
Thank you!

Well, you have 1 very big mistake. When you press L, you should only spawn 1 actor, and then you need to add all of the static meshes. Can you post your BP where you create your static meshes, I need to know how many components you are creating, and if you are using static meshes or instanced static mesh components.

  • Instanced Static Mesh Components
  • As many as the player places

I uploaded the whole project, you can take a look:!4ARF3ZhL!AsaOK0pNMXNo03y2NEhVJO24bps9RxwUz46dfeGSQso

Save-thing is placed in the level-blueprint

I should be done getting the save function finished, but quick question, can players rotate blocks? Scale blocks? Or can they just place them, and the scale and rotation are always the same?

you are my personal hero of 2015, really.

only rotate (around every axis), no scaling. [Rotate: Q,E,R,F-Keys, and there should be a reset-key xD, i think it is T? - just if you want to try it out.]

Saving the player position too would be nice - but i am asking for too much. (since that is not TOO complicated :D)

Shouldn’t be a problem, just give me a few minutes to run some tests. Personally I have never dealt with loading and saving, so it may take me a bit longer.

take your time, I am “trying” since weeks :stuck_out_tongue:

Ok, “Jamendxman3” got it to work, and it is huge :smiley:

This is the solution he found:

Well done!