Project
Beginner Gameplay Scripting
OnMouseDown
Tutorial
Beginner
5 Mins
Unity Technologies
Overview
You have completed 0% of this Tutorial.
1.
OnMouseDown
Summary
How to detect mouse clicks on a Collider or GUI element.
Language
English
Recommended Unity Versions
4
1.
OnMouseDown

MouseClick

using UnityEngine; using System.Collections; public class MouseClick : MonoBehaviour { void OnMouseDown () { rigidbody.AddForce(-transform.forward * 500f); rigidbody.useGravity = true; } }

Woohoo! You nailed this tutorial.
Continue rocking your Beginner Gameplay Scripting project.
Next Step:
GetComponent
Tutorial
Beginner
5 Mins
Unity Technologies