How to ignore mouse click at background layers or objects?

I’m developing simple fix it kind of games. Here if i clicked at the object it will instantiate new layer in front of the background layer. But the problem is when i click on the top layer the click also affects the background layer. How to avoid it. I used layer based collision and collider on the top layer but no use. Please anyone give me any idea…
Thanks in advance.

Hi, you can do this…

[SerializeField] private LayerMask inputLayerMask;
private void Start()
	Camera.main.eventMask = inputLayerMask;

Then in the game object’s inspector set what layer mask, or masks, you want to receive mouse input.