I got a CameraController attached to the Main Camera,now I can DO SOMETHING by pressing left button and dragging left and right,but the DO SOMETHING happens when I just left-click somewhere on the screen.
I don’t want the left-click,so Any way to disable the left click ? or any other way to solve this problem ?
If I understand you correctly you should just add some checks to see if the user is dragging/holding the mouse.
(example code)
//GetMouseButton will return true on any event (down/up/hold)
//GetMouseButtonDown will return true only on the frame in which the button press was detected.
//GetMouseButtonUp will return true only on the frame in which the button release was detected.
//So you could add a check to see if the user is dragging by..
//Example:
public class DetectDrag : MonoBehaviour
{
private float timeStamp;
private bool isDragging;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
timeStamp = Time.time;
}
if (Input.GetMouseButton(0)){
if ((Time.time >= timeStamp + 0.5f) && (!isDragging)){
isDragging = true;}
}
if (Input.GetMouseButtonUp(0)){
if (isDragging){
isDragging = false;}
}
if (isDragging){
//DO SOMETHING;}
}
}