prevent OnMousedown to trigger when 2 objects overlapping

case :

i want to make ui attached to a 3d object in real world,

-the cube is performing animation when clicked, the trigger is using onmousedown()

-also the ui button which is attached to the cube will toggle an info panel when clicked, the trigger also using onclick() on ui button

problem:

when i clicked on button, both of them perform their action instead only button triggering toggle info panel

i have tried:

i create a script to listen the event with unityevent, it subscribe to buttonscript and cubescript but then the editor not responding when played, now i have no clue

code

button script:

public void showConsole(){
		Debug.Log("button clicked showconsole");
		toggleClicked();
		e_clickEvent();
		Debug.Log(a+"<<<<<");
	}

	public void toggleClicked()
	{
		isActive = !isActive;
		Debug.Log("panel is "+isActive);
	}

*when clicked it trigger showconsole()
*please dont mind toggleClicked(), it only fill with debug log

cube script:

public void OnMouseDown()
	{
		// triggerAnim();
		e_clickObj();
	}

*please dont mind triggerAnim(), it only fill with debug log

image:

In your mouseclick detection method you could do sth. like this:

if(EventSystem.current.IsPointerOverGameObject()){
     if(!EventSystem.current.currentSelectedGameObject.name.Equals("name of your button")){
           //perform cube animation if my button is not clicked
     }
}