How to use a blueprint to edit or change the material of a different object

Disclaimer, I am very, very new to Unreal. I am taking a college Intermediate Game Design course and there’s something I’ve been trying to figure out. I currently have an Interaction event set up so that when I press Q I fire a line trace that can trigger certain events when it hits certain objects, for instance turning a light on and off. I have an alien looking cube made of box brushes using the CyberCube texture that comes with the GTFreeMaterials content pack available in the Marketplace for free, but I have altered the material not to emit light. What I want to happen is that when I walk up to and “Interact” with a keyboard item I have placed, the CyberCube material to either be edited to once again emit light, or to swap the material to a different version that emits light. Either solution would be acceptable, but I have no idea how to go about doing it. Other people’s guides are too advanced for me and rely upon all kinds of advanced knowledge that I don’t have, and the official Unreal tutorials are outdated and still kind of confusing. Some help for a stupid person would be greatly appreciated. My class uses 4.15.1

Hey SSInfinity,

I’ll give you a little background info before trying to answer your answer. Your object can have many materials assigned to it. example: In the default Sphere static mesh, I added a bunch more materials. At some point with a more complex model, I can assign those different materials to a different part on the mesh. To add more materials to an object you can click the “+” next to Material slots. BUT thats not the point of this example. Each material is given a Element number. As you can see it starts at 0 and goes up. This is the point of the example.

The next step is accessing the Element number for your material swap.

234449-material1.jpg

As you can see my object is assigned the BasicShapeMaterial at Element 0. This is important.

In my sphere object blueprint, I get a refernece to my sphere object and when it hits my other cube object the material is changed AT Element 0 for the BasicAsset03 material which is just another default Unreal material

Hope this helps!

you could also accomplish this though thee use of a scalar parameter and a set scalar parameter node. basically in your material you would multiply you emissive color by the scalar parameter value, so if you multiply by zero then there would be no emissive but if you multiply by 100 then there will be. this also will allow you to control how intense the emission is. then in your actor blueprint you would just call the set scalar parameter value. you need to make sure the material is equipped and that the parameter name matches exactly. below is a picture showing the basic setup and the nodes. in my test setup i made the material then connected the set parameter to a timer and a flip flop to create a flashing light.