Problem for save vector parameter value and set it in material instance after reload game

Hello guys,

i’m trying to save some vector parameter value from every dynamic material in my scene so for that i have no problem but my issue is when i try to apply this value when i close and restart the scene with a save object.

Currently the things that i don’t understand is like my reload function (so take back the information of the parameter value in my save object) is not working at the start of the game, but if with a custom event i set a parameter value and next to this i launch my reload that’s work.

An other information is in my reload function i print the element parameter info name at start and there are not printed.

This is like i need to interact with the material instance to use my function.

Thanks you and sorry for my english !

Function save : save function posted by anonymous | blueprintUE | PasteBin For Unreal Engine
Function reload : Function Reload posted by anonymous | blueprintUE | PasteBin For Unreal Engine

I don’t see any save and load happening there.

You need to use a save game object.

I’d recommend making the code REALLY SIMPLE to start with. Just save one param on one material, then expand from there. You don’t want to be troubleshooting both systems at the same time.

1 Like

Yes, i just not copy that part cause i have other things between but it’s ok on that part i can just link you the full section

Save Function : Save2 posted by anonymous | blueprintUE | PasteBin For Unreal Engine
Load Function : Load2 posted by anonymous | blueprintUE | PasteBin For Unreal Engine

You only need to create the save game object once. You’re creating it every time you do a save, which will means that anything saved previously is erased.

You’re also saving based on object name. I think that could be pretty unreliable, and possibly doesn’t work in a packaged game.

Apart from that, the code is too convoluted to follow.

Like I say, try a simple example first.

Here’s my save game 101

1 Like

I achieve to to a savegame and load with the position of my object, i understand how that work but i can’t figure how to do this easily for dynamic matierial instance that change in runtime save the last configuration of this material and load it the next time.

It’s easier if you make each actor a BP, instead of just a static mesh.

Then, each one can have an ID ( int ), which is its offset in the settings array ( in the save game ).

When you reload the level, each one can just read the correct index in the array and reset the material instance, which they are decorated with.

I found the solution of my problem,

The problem was that the parameters of material instance dynamic was not available and return empty at start of the game cause i needed to first create a material instance on my content browser and activate the parameter then create a dynamic material in my bluperint from the base of this material instance that i create before.

I don’t know if it’s a bug or somethings else but i found that few other people encounter the same issue.

This is a thread that help me : Possible to read the Parameter Name of a material using blueprints?

Hope that can help some people, and ty for your time.

1 Like