Mouse Sensivty Problem

Hello Everybody,

I have a problem with Mouse Sensivity. I have a code as that

var Prefab  : GameObject ;
var Prefab2  : GameObject ;
var Prefab3  : GameObject ;

function Update () {
    if (Input.GetMouseButton(0)) {
        var ray: Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        var hit: RaycastHit;

        if (Physics.Raycast(ray, hit)) {
            Instantiate(Prefab, hit.point, Quaternion.identity);
        } 
    }
}

I placing an item when i cliked the "mouse 0" but my problem about mouse sensivity when i clicked the "mouse 0" placed a lot of the same object in the scene.

How can i place only one object scene ?

Regards

Use Input.GetMouseButtonDown instead of GetMouseButton. GetMouseButton returns true every frame the button is held, GetMouseButtonDown does it the frame you press it only

Try this:

function Update () {
    if (Input.GetMouseButtonDown(0)) {
        var ray: Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        var hit: RaycastHit;

        if (Physics.Raycast(ray, hit)) {
          Instantiate(Prefab, hit.point, Quaternion.identity);     
            } 
    }
}