I am triying to change the material for a specific actor, throught a widget button. Everything working fine for changing actor class material (it changes the material for all same class objects), but i want to change only for the specific hit actor with my linetrace.
i have created a hic actor variable, and i get this variable from the widget graph.
Are you storing a list of these HitActors in the blueprint? Or just one if there is only one line trace?
You can do a comparision check between the HitActor against each Actor in your for loop from the OnClicked function. If the actors are the same, set the material, otherwise do nothing.
that hit actor is a varible i set from linetrace in first person, for each hit. as it is a reference of the object i am “looking at”, i guess i can reference to this variable and change only its material… cant find a way to do that
Here are two examples if you have one or multiple hit actors. On your tick function, make sure to set a variable in the blueprint to store the actor in order to do the comparison.
Nice! ny way, when you use the set material node, you cant reference the hit actor, so i creatd a variable for the hit component, and now it is working.
that script is extremely inefficient. your running a bit off tick and thats not the best way to get the actors that you need. you dont even have a line trace shown in the pictures.