unity click on 2d object
Code Example - unity click on 2d object
// Requires for the object to have a collider and this script attached
private void OnMouseDown()
{
Debug.Log("Clicked on object!");
}
// Requires for the object to have a collider and this script attached
private void OnMouseDown()
{
Debug.Log("Clicked on object!");
}