Changing Materials through blueprints?

I am new to this whole blueprinting idea… And very much need some help!
What I have is a game where walking over the colour red sends you back to the beginning.
However now I would like to add some new mechanics. Yellow tiles will swap all red and yellow tiles around once you have stopped walking on them.

For example, the picture below shows a top down view of some cubes I will have placed down. The red kills you, the yellow will swap the colours around. I do not know however how to make blueprints for the yellow?

I would need it so once you step off the yellow, the properties switch? Is there a way I can set up a blueprint so that it checks what material is applied, and executes a function based on this?

Help is much appreciated!

If you just want to change properties of your material during runtime you can use Material Instance Dynamic. You create them in the blueprint, assign them to your mesh, then you can change any parameters of your material during runtime.
You can also read the current value of any parameters during runtime (for example to check the color).

You won’t have any issue finding how to use them on the web. Here the official documentation link :wink:

Good luck :slight_smile:

What is a cube?

I think you have one BP with a cube, which has 2 states. Save the current state as enum, not as string like in my pictures! You can get an idea how to do it by these pictures, but there are so many bugs and dirty things.

The LevelFlow: make “CurrentColor” public (in your variable tab on the left the eye).

Now you can place your cubes in the level and for each cube you can choose the start color in the “details panel” on the right.

Thank you this is awesome!