Hey guys, I’m playing around with lights, one thing I would like to do is turn on a light using a button I created in UMG. Right now I have a car and I want the user to be able to toggle the headlights on and off. Is there any way to achieve this? I’m still pretty new so pictures or sending me a link would be ideal unless you can write a step by step on what to do. Thanks!
The most efficient way of doing this, in my opinion, is to simply have two materials and have them be switched on the press of the button. Here is an example of in my game when I press the Handbrake, which is space bar on my keyboard, it will change one material to another and when I release the hand brake the light turns off.
Now to brake down the image for what you want all you would have to do is just replace the Handbrake with your button input action and make sure to reference the mesh you will be applying it to.
As you can see I have two different materials, one named RearRed_Lit which is a red light emitting material and RearRed which is just a basic red non light emitting material. The element index is the index of which material I will be replacing on the vehicle, which happens to be the 5th index. As seen below: