OnMouseDrag is called when the user has clicked on a Collider and is still holding down the mouse.
OnMouseDrag se llama cada frame mientras que el mouse está presionado.
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public Renderer rend;
void Start() { rend = GetComponent<Renderer>(); }
void OnMouseDrag() { rend.material.color -= Color.white * Time.deltaTime; } }
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.
OnMouseDrag can be a co-routine, simply use the yield statement in the function.
This event is sent to all scripts attached to the Collider.