Version: 2019.4
LanguageEnglish
  • C#
Removed

EventType.mouseDrag

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Obsolete Use MouseDrag instead.
Upgrade to MouseDrag

Description

An event that is called when the mouse is clicked and dragged.

//Attach this script to a GameObject
//This script is a basic overview of some of the Event Types available. It outputs messages depending on the current Event Type.

using UnityEngine;

public class Example : MonoBehaviour { void OnGUI() { Event m_Event = Event.current;

if (m_Event.type == EventType.MouseDown) { Debug.Log("Mouse Down."); }

if (m_Event.type == EventType.MouseDrag) { Debug.Log("Mouse Dragged."); }

if (m_Event.type == EventType.MouseUp) { Debug.Log("Mouse Up."); } } }