Thanks! that helped in my case.
Go to Project Settings → Rendering → Postprocessing
and set there “Custom Depth-Stencil Pass” to “Enabled with Stencil”.
now in shader you can get Custom Depth stencil value like so:
using this approach we can change outline color of different actors on level.