Download

How to maintain a material change throughout all levels?

I understand that you need to use a gameinstance blueprint somehow. I created one but have no idea what to do with it.

  1. I have a level with a menu/UI that first opens with the game where they player can select the color they want for their character.

  2. As soon as the game begins (because it is a new level) that change resets to the default color of the character.

I don’t understand how to store variables of different colors. Do I assign a number to each of the 9 colors? How do I write a blueprint that swaps between them when the player clicks on the corresponding color icon in the original main menu? How do I link a button to change the color of my character, if the character doesn’t appear in the same level as the main menu because it’s a UI only?

https://www.youtube.com/watch?v=XjPdyoy7ySo This video doesn’t help because he is storing a score variable. No idea how to store materials. Also, he does not show how to map a button selection from a UI to change the color of something else.

https://www.youtube.com/watch?v=oumfJsv7KEk&t=209s This dude does show how to map a button to change color of an object, HOWEVER that object is placed in the same scene and my character doesn’t actually appear until the main game level starts, which means by the time the level changes, the material reverts to default.

Do I store the “set material” node in the character blueprint? In the gameinstance? In the UI blueprint? I am so confused.

Help?

You have to put this info in the SaveGame, not game instance.

When a player chooses a color, it goes in the save game. How you do that is up to you, maybe an array of player IDs ( just an integer ), or player names, and their color.

When a player starts a new level, their character reads the correct color from the save game.