What do 2D Mouse functions rely on? Sorting order?

I have many sprites and they all seemed to follow a certain rule. The rule seems to be that the highest sorting order is the one that registers the Mouse function.

However, I now have a fruit that grows on a tree, and even though it appears behind the tree leaves and I am clicking on tree leaves, nothing happens to the leaves. I debugged MouseOver in the tree leaf script, and it didn’t register when there was a fruit behind it. the Z positions of both the leaves and fruits are set to 0, and the sorting order 6 for the fruits and 7 for wood, and 8 for leaf.

If the fruits are drawn behind your leaves, it’s impossible for them to block the leaves. Raycasts are registered on the closest z depth or the top most sorting layer. But there can be other problems like layer masks or canvases getting in the way. Re-check your drawing order, and check that your leaves actually work all by themselves. Pull them apart in z-space as a test, maybe your colliders are somehow misaligned and are overriding your sorting order.