saving material instance dynamic to savefile

Hi,

I need the player to set a few parameters to a “Material Instance Dynamic” and then save that instance for usage the next time he/she loads the game.

I tried making a “Material Instance Dynamic” array in my save file class and wrote all the created instances to it before saving, but, when I load the saved file I find all the saved instances are NULL.

Is it possible to save materials using this approach? Any other working alternatives?

Thanks

You can not store anything that is actually used / placed in your level in the savegame object. It only stores references to them and those will be destroyed when you unload the level and the reference will become invalid. That’s kind of the point behind a dynamic instance. That it’s dynamic and used during runtime.

You will have to create a new one in every level you have, store the parameters in your savegame object and apply it to your new instance.

Cheers

That makes a lot of sense. Thanks for the great explanation.