xxxxxxxxxx
private void OnMouseOver() {
Debug.Log("Hovering over GameObject");
}
xxxxxxxxxx
using UnityEngine;
using System.Collections;
public class Click : MonoBehaviour {
public GameObject gameObjectToClick;
void OnClick(){
gameObjectToClick.SpecialFunction(); //call special function you wanted to call
}
}
xxxxxxxxxx
using UnityEngine;
public class ClickHandler : MonoBehaviour
{
private void OnMouseDown()
{
// Code to execute when the game object is clicked
Debug.Log("Game object clicked!");
}
}