Descripción

OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider.

Este evento es enviado a todos los scripts del Collider o GUIElement.

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

public class ExampleClass : MonoBehaviour { void OnMouseDown() { SceneManager.LoadScene("OtherSceneName"); } }

Esta función no es llamada en objetos que pertenezcan a la layer (capa) Ignore Raycast.

This function is called on Colliders marked as Trigger if and only if Physics.queriesHitTriggers is true.

OnMouseDown can be a co-routine.