Hi guys. I am trying to save object materials to save game. I can succesfully save when i select material from blueprint manually. But when i get material from object with “get material” blueprint it saves “none” on save game.
Thanks for reply. Sorry my mistake. At the original code savegame objects are linked. I guess I captured when i unlinked them to rty something. But the issue is not that. As i said above i can save “Avatar_Mat_Ins” variable successfully. The key names exist at save game file and i can reload them but material slots are empty.
If i unlink “get material” blueprint and select material manually at “add” blueprint, it saves the material and i can reload it. The object linked to “get material” has a valid material.
If you right-click the get material node, and promote to variable. Do you get the same type as your save game map?
Also, not the problem here, but you’re creating the save game every time. You only need to do that the first time. After that, read it and update and write back.
Yes. The variable and save game map are same. When i select the same material manually at “add” blueprint as the second screen caps, it saves succesfully.
Thanks for the suggestion about creating save game every time, by the way…
I guess i found the problem. I created “TargetColor” variable with right clicking avatars hair (get hair blueprint) and promote to variable option. It created the variable type “primitive component”. I changed variable type to skeletal mesh component and it worked. Thanks for your interest.
Let me ask you another question. I want that users can change the hair color of the avatar and save it. I created all widgets and users now can change the color with sliders. The question is what is the best way to store this changes? Storing color or material itself (or another way).
I am using “create dynamic material instance” blueprint to create the dynamic material and “set vector parameter value” to set new color to parameter. It works for changin color of hair but am i doing right? If i save this dynamic material instance, will it be reloaded with color changings? And may i set this dynamic material instance to my avatar (Third person character)?
it may be easier to make an enum for each material/color type, and then when loaded you can use a select node to match materials to the enum. This way all you have to save is an enum, or a map of string/enum.