How to make a GameObject a button?

I’m developing a game in which you have to find a button in a room, for the script i’m using this and just putting it on the button

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class OnClickLoadNextLevel : MonoBehaviour {
	void OnMouseUpAsButton() {
		SceneManager.LoadScene (SceneManager.GetActiveScene().buildIndex + 1);
	}
}

but this creates some weird bug where you can’t be too close to the button to click it, and it sometimes takes a few clicks to find the point at which it works, is there any other way i could do this?
If you wan’t to see the bug yourself go to
Game Jolt - Share your creations

Use OnMouseDown() method of monobehaviour

It will be called when you click gameobject

Write your code in this method

reference : OnMouseDown

in ufps demo, there is a button implementation.
i think they are using raycast.