Its been some time since this was asked but, I wanted to offer up a method for anyone who may stumble upon this thread because being aware of many options is always good.
-
If you wanted a more stylized approach, you can do outlines around your object in a custom depth pass, only when they are behind other objects (out of line of sight) with a post process material and post process volume, theres plenty of tutorials of that around but it is complicated.
-
You could simply create a material and mark it as transparent which will allow you to set “Disable Depth Test” on the material, making it appear on top of every other object. However this will sacrifice many details the material could have since Materials that are transparent dont support the same quality of lighting and overall functionality as Masked/Opaque, etc. (unless perhaps in Forward Rendering mode but Im not entirely sure on that).
-
Another option if you want to not use an outline, but rather make the whole object visible through a wall, but still allow it to use a non-transparent material, is you could have it toggle between its “normal” (in line of sight material), and a transparent material for when its out of line of sight. The easiest way is to do a simple LineTraceForObjects (or Visibility), and have it trace a line between your camera (Get Player Controller 0 > Get Player Camera Manager > Get Camera Location), and the actor’s world location that you want to see through a wall. Basically if the line trace returns with a hit, you just set the material to the transparent version so it suddenly shows up anywhere you are. If the hit fails, you set it back to normal material. Because the transparent material is separate, it also gives you opportunity to do literally any of your own stylized stuff to it, since its a material all on its own for that very purpose of allowing you to see it through walls. Can make it shiny, make it glow, make it a solid color a tint added to it, maybe even a tint based on distance or other variables, can get really creative about it indeed.
Anyway, those are some ideas that come to mind, I hope I can be of help to anyone.