Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

BaseInputModule.IsPointerOverGameObject

Switch to Manual
public function IsPointerOverGameObject(pointerId: int): bool;

Parameters

pointerIdPointer id.

Description

Is the pointer over a GameObject that is controlled by the EventSystem.

If the module is pointer based, then override this to return true if the pointer is over an event system object.

function Update()
	{
		if(Input.GetMouseButtonDown(0))
		{
			if(!EventSystems.EventSystem.current.IsPointerOverGameObject())
			{
				Debug.Log("Did not Click on the UI");
			}
		}
	}