how to use getmousebuttondown unity code example
Example 1: GetMousebuttonDown unity
if (Input.GetMouseButtonDown(1))
//This is too stop spaming the gun
Example 2: how to fix on GetMouseButtonDown activating UI unity
using UnityEngine.EventSystems;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
// This line prevents the Code from activating UI
if (EventSystem.current.IsPointerOverGameObject())
return;
// Put your code here
}
}