Hit Actor Material Change Error

What I want:

The trace is fired from the camera’s forward direction.
I want to change the material of the actor that the trace hits.

When the actor is no longer hit (for example, if the camera’s view changes and the trace hits a different actor), I want to reset the material of the previously hit actor.

The issue:

I was able to successfully change the material of the actor hit by the trace.

However, when the camera moves and the trace hits a different actor, the material on the previous actor does not reset.

I think maybe your temp variable is not managed correctly? This is the same thing with static meshes

trace

2 Likes