How can I swap the material on my player actor when it passes through triggers?

I have a box that is white (material white) and two triggers. I want one trigger to turn the cube blue and the other to turn it red once the box passes through them. However, If the box has been turned blue I don’t what it to be able to turn red if it passes through the red trigger. (and visa versa)

I currently have this in my blueprint and it’s working fine however I want to put some sort of condition (where my ReplaceMaterial Boolean is) to check if the box is red.

Is this possible? Any ideas?

Many thanks.


Great! This will do what I want it to do. Many thanks for this Sean!

Hey RobSteptoe,

Try this:

I created ReplaceMat?, which is a boolean that starts out as true. After the material is changed, it is set to false. Before setting the material, a check is performed to see whether the boolean is true, and if it is, it will set the material. If not, it will not set the material.

Hope that helps!