Saving material

can anyone give me some hints or help on how to save an objects material (in runtime would be great but not necessary). I’m having a large amount of meshes that I can click on to toggle between three different materials. I would like these changes to be saved so when you quit/relaunch the game your changes remain.


Obviously if it’s not runtime then you can just save the level / mesh.

At runtime, then you need to use a save game:

Are you looking to save a material to a texture for performance reasons? Or just save a material configuration? If it’s the latter, then SaveGame is the way to go as ClockworkOcean said.

Thank you Clockworkocean, ill watch it and see if I’m able to implement it!

Jared, just saving the user configuration. It’s supposed to work as an aid for a 75y+ client with little computer experience. So getting it to save in runtime and limit the ui to as few options as possible is preferred.

Lets see if I can implement something from that video…

Ok I think I get it but I don’t understand how to implement it on all the meshes. Do every mesh need a unique variable that communicates with a unique variable in save game blueprint? I’ve got about 500+ meshes that I want to toggle material on and save.

It’s a little hard to image what you have going there, maybe you can elaborate a bit, but…

Yes, basically. Each mesh would need an ID, and you need to save the ID with the material you want to be known for that mesh.

These IDs are something you invent yourself, it’s not a system thing.

If your meshes are blueprints, it’s easy, just add an integer variable ( different for every BP ). When the user changes the material the BP writes it’s ID to the save game together with the material used.

If the meshes are just plain static meshes, bit more fiddly. You would need to so something like saving the level and object name and the material.

Sounds like a bit of a pain, right? That’s how it works I’m afraid.

The other alternative, is to get a plugin to do it for you:

Its really simple, nothing fancy but would be really useful. I’ll attach images. Every dot represents a mesh, when “hit” it changes the material.

Below the blueprint for the mesh that changes material

Im actually trying thtat plugin right now but cant manage it to same my variable. I have followed the documentation but my variable “setmaterial” isnt saved.

Had no idea this would be so hard to accomplish. All the graphics from 3ds max is supereasy to retrieve now with datasmith, i already have nice 360 renders but this is a pain like you said.
Did a inventory based 2d game a couple of years ago in a 2d engine with lots of save functions and that was so easy compared to this.

Since im on a deadline, do you know if there is a “marketplace” for getting this relative small project done by someone how knows what to do? Paid of course.

Yes, so at least you have the material as a fixed int from an array. That’s a good start.

If all the BPs also had their own ID, then you have everything you need to do it with the default UE save game. You’d need a little bit of code to set the IDs, just get all actors of class and then set ID, but you’d need to do that in the level BP as an editor mode custom event. If you don’t know about that it’s probably quicker to get the plugin working, but I’m afraid I haven’t used it.

EDIT: Ok, I read the docs. You just mark the variables for saving.

Then you need to use those blueprint nodes ( in the quick start ) to do the actual save and load. Did you do that?

PS: Place to offer jobs is:

Yes, i followed that short tutorial. Its marked for saving and the save and load is up and running. I also attached a print string in the bp above so im sure the variable is changing. I can see in the save folder that the.sav file is being updated wgen i save. But somehow the integer variable “set material” either wont save or load.

You’d need a little bit of code to set the IDs, just get all actors of class and then set ID, but you’d need to do that in the level BP as an editor mode custom event
Okay that would set Id’s for me?

I was looking at your code. I think the shapes are loading their color before the save game has had a chance to load.

I assume you’re doing the savegame stuff in the level BP?

Then you need to edit the shape BP, so there’s a delay before loading the color on begin play.

Ok i tried that, up to 2 sec delay but still no successful save/load. I can see that the game loads or resets something since the clouds in the background jump to another position. No idea why it wont work and the save plugin has very little information.

Yes the savegame stuff is in the level BP.

After reading comments on the marketplace site and their github it seems like the SaveExtension plugin has some problems. Several has the same issues as me. Hopefully they will comment or fix this, in the meantime i will have to do it manually or look for another plugin.


If you quote me I get a notifcation, otherwise it’s pure chance that I see this…

So, with a UE savegame. Do this:

Somewhere very early on, only once ( ever ):


Then inside your BP, to save color:

and to load color:


@ClockworkOcean thanks, I’ll look into it as soon as I’m back at the computer.

just a short one; would it be easier to use a destroy/spawn actor(mesh with other material) instead of set material setup? In regards of saving/loading all these meshes.

It’s worse. Just changing the material is easier, at least you don’t have to spawn them also :slight_smile:

Check out that stuff I gave you, if you can’t get it working, come back.

Also, if you project isn’t too massive, maybe I can download it from somewhere and take a look…

@ClockworkOcean ok then I know! I’ll do that! No it’s not massive at all. At the moment it’s just a basic cube. Once I’m able to save it it’s time to try it out on several cubes. As soon as I’m able to save/load a lot of cubes with chosen material I will start importing from 3ds max.

I will make a proj with a few cubes then… Gimme a little while…


When you fire at them, they change color. Exit the game and restart, they know thier color.

They have already been numbered. The BP in the foreground is an example of how to number a large amount of cubes. When you click on it, in the details, there’s a button.

Delete the save game if and set the cube numbers to zero if you want to try from scratch.

If you use parameters on Dynamic Material Instances instead of using “Set Material” nodes to change colors, then I have two plugins that can do what you need;

With PDM you just have to setup your material instances, change public material params at runtime then use “Capture Material Snapshots” and “Restore Material Snapshots” nodes.
This system has been used on several archviz projects:…amic-materials

“Savior” plugin can also do the same, but it’s a way more complex/complete save system for complex games:

@ClockworkOcean wow thaks alot, so very kind of you! If i would like to apply this to my imported meshes from 3ds max, i guess the easiest way would be to just select all of them and right click ->Replace selected actors with “ColorCube”. Of course with a new “ColorCube” mesh - the very same as the one i will replace. Or is there another way that is way smarter?

Can I replace the random integer so that it goes from material 1 til 3 and then back to 1?

Again, super kind of you!

[USER=“434”]BrUnO XaVIeR[/USER] thanks, i will check it out, several really neat plugins!

No problem :slight_smile:

The trouble is, they need to be blueprints, that’s how they respond.

You could replace all your meshes with color cubes, but maybe you have spent a long time getting them to look a certain way etc.

If that’s the case, you could just take the color cube BP and replace the cube with your mesh.

I don’t really know what your situation is…

PS: If all your imported meshes are different, you need to put a mesh array in the color cube BP and populate it with your imported meshes. Best of both worlds.