How could I switch a material of an actor by shooting it?

I am using the first person template and I was wondering if there would be a way to make the projectiles change the material of an object when they come in contact with that object? If this is not possible, could I possibly use raytracing to achieve the same effect? Thanks.

Sure , make sure that your projectile have the setting “event hit” active, maybe also the target mesh need that.
Enter the projectile blueprint, add ““on hit event”” now based on what you are shooting , you have to access to the mesh of the actor, or just the mesh … as you can see the "on hit event “” you can pin out the Other, and , for example, ad a { cast to “my_actor_button”} and then add the node "set material (+static mesh) ".
But if you shoot to a simple static mesh , you cant cast to the actor, you just take the mesh and set his material.

Hello,

I used a line trace in a test project to change the material of an object. What I did was go into the first person character, and on F cast the line trace from the character. I then broke the hit result of the line trace and performed a cast of the hit actor to the actor that I would like to change the material of. After this, I called Set Material on the Sphere component of my Detect Line Trace actor, and change the material using the dropdown on the node.

Here is an image of my blueprint:

Let me know if there are any further questions.

Have a great day