How to detect if a sprite is covered by another sprite

Hello everyone,

I have a side scrolling game where I want to outline the player sprite when it’s behind another sprite. I have a outline script, but now I have to figure out when the player sprite is covered by another sprite, so I know when to show the outline, and when not. Any ideas how to do that?

Best,
Verdemis

I think will be better to use something from asset store for this task.
For example: Unity Asset Store - The Best Assets for Game Making

I already bought two outline assets in the asset store. This which you posted too. But they don’t solve my problem.

I don’t think there’s a way other than raycasting. At least it’s just your player, so it won’t be too expensive.

There is overlap area also: