Im using FPS template, and i have some boxes in the scene, i was able to use ray cast to hit a Box, ok, so far so good,
what i want to do, is when i hit the box with raycast, it change the material, but i cannot find any way to set a custom variable to each box, i want to put something like on hit, set “isRedMaterial = true” to that box , so then i just can if was true before, set to false and use material blue
right now im using the Flip node, but is global so if i hit a box before, when i hit another box, would be checking the previous state of the Flip node, and not per object
Create your own Blueprint (with your Box Static Mesh), call it “BoxBlueprint”. Add a boolean variable “isRed” for example.
Now add an event to this blueprint, called “RayHit” for example. In this Event, you simple toggle your boolean.
isRed = !isRed.
In your player blueprint (or where you start your raycast), you get the HitActor and cast it to your newly created “BoxBlueprint”.
From this BoxBlueprint Object, simply call the RayHit event.