How to ask for input when user clicks on another gameobject?

Hi,

I want to activate an Input Field when the player clicks on another gameobject. How would I accomplish this?

if the game object has a collider and a script that takes an input :
void OnMouseDown()
{
inputField.SetActive(true); //or inputField.ActivateInputField();
}