- Home /
Question by
MerlinsMaster · Jul 05, 2016 at 05:13 AM ·
right clickmouse button
Can't get object to respond to right-click
Hey Guys,
So I'm trying to do this thing where if I left click on an object, 1 is added to a variable, and if I right click on it, 1 is subtracted from that variable. The left click works fine, but when I right click, nothing is happening.
public class cs_SliderClick : MonoBehaviour
{
public int sliderValue;
void Start ()
{
}
void Update ()
{
}
public void OnMouseDown()
{
if (Input.GetMouseButtonDown(0))
{
sliderValue += 1;
}
if (Input.GetMouseButtonDown(1))
{
sliderValue -= 1;
}
}
}
Can anyone tell me what I'm doing wrong here?
Thanks.
Comment