Detect mouseclick

Hi!

I'm new to Unity and I'm having trouble finding good resources for C# and Unity so I'll ask my question here.

I want to detect if a user presses the left mouse button, the code I'm having now is:

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour
{

    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
    }
}

Thanks for answers.

You can detect the left mouse click with:

if(Input.GetMouseButtonDown(0)){
    // do something
}

Have you tried looking at the docs? You could just type "left mouse button" in the search field for the scripting reference.

Lots of answers using the search feature on this site:

http://answers.unity3d.com/search?q=detect+mouseclick+mouse+Cs