Double Clicking mouse
so like to chop down trees you know how you usually chop it down in like ten hits or something, in certain games i want to do that with my ray cast script ive tried everything i thought of and i couldnt find it in the Documentation i just want something to triple click on a simple mousedown like this so i know
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
void Update ()
{
if(Input.GetMouseDown(0))
{
Application.LoadLevel("SomeLevel");
}
}
}
so i want to make it a triple click with the getmouse down im really stupid when it comes to C Sharp lol thanks moderators :) i appreciate your hard work and everything you do for everyone that needs help
Answer by Positive7 · Sep 01, 2015 at 09:24 PM
int counter = 0;
void Update (){
if(Input.GetMouseButtonDown(0))
{
counter++;
}
if(counter == 3){
Debug.Log("asd");
counter = 0;
}
}
Your answer
Follow this Question
Related Questions
Why does Bool code never work in my C# Script? 1 Answer
Return key triggering a button OnClick? 1 Answer
Problem when acessing a list from another script? (ArgumentOutOfRangeException) 0 Answers
Objects are created in the same location. 0 Answers
RPC Instantiate issue, Prefabs incompatible with MAC ? 0 Answers