Show PostProcess Outline on objects only when in range

Hello…
I’m trying to automatically show the post process outline effect on objects that can be used, but only when in close range to them.
So I want to set the render custom depth to on, on an object that is usable, when I’m near it.
I tried to set something up…

the print strings at the end are only there for me to see, wheter or not I’m hitting anything at all. I want to replace them with the set render custom depth function, but I don’t know how. I’m new to UE.

So 1: The render custom depth needs a target, that should be the object, but how do I get it set up? And set it up for all usable objects I have (but that only the objects in range get outlined, not all usable objects). Do I use an array, or a class? Can I set up a variable? And if so how?

2: I used a capsule trace by object (used it for interaction with objects, so i just tried to reuse it for the outline). is that a good idea? or is there a better solution? and what about event tick trace in general, is it too much for the performance having it run all the time?

if anyone could help me out, it would be greatly appreciated. and if you need more infos, i’d be happy to post more screens.

so I got as far as this…

so the outline gets visible / render custom depth gets ticked, when i’m near the object,
but it doesn’t get unticked when i move away.
it gives me an accessed none error for the unticked custom render depth, i don’t get
how to make it work.
could somebody get me started in the right direction.

and still is there a cleaner way, because i think this is all really clumsy set up.
because now every object i want using this has to come from the same blueprint (highlightable objects)
and not just a static mesh in general. could I maybe use a custom trace method for static meshes?
tried that as well, which worked for half of it. the outline appears when i hit the object but it doesn’t
un-outline it anymore, when i look away and i get the same accessed none error.
still this direction looks a bit cleaner.

does somebody has an idea? or a different, more elegant solution?

so, I figured it out… somehow. lots of tutorial reading.
here’s the updated blueprint…

but now that that works, a new problem arose. the outline effect gets turned on and off as intended. but when the trace hits an object, sets the outline to on, and then i move the trace to another object that is in front of the old object (or behind it), like overlaps visually, the outline on the first objects doesn’t get turned off again. see picture…

I kinda understand why, because technically through how i set it up, the trace is still valid because the trace channel is still on an OutlineObjectTC trace channel.

So, my question, can I somehow turn off the outline from the first object, when I move the trace to another object that’s visually over/underlapping?

it’s working!

in this thread

Alderbit showed me how to set it up properly. kudos to him.

Hi!
I’m going through this same situation: I want to outline an object when i’m close to it.
I saw that you posted the proper setup, but I’m asking some other details about that.
Where do I have to put all these nodes? In a specific blueprint?
And what is “crosshair style” in the last node you posted here?
Thanks a lot!