Quantcast
Channel: Questions in topic: "count"
Viewing all articles
Browse latest Browse all 187

i get more clicks than the clicks really happens

$
0
0
i have this code `void Update () { if(Input.GetMouseButton(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit rayCastHit; if(Physics.Raycast(ray.origin, ray.direction, out rayCastHit, Mathf.Infinity)) { clicks+=1; Debug.Log(clicks); if (clicks%2!=0) { Time.timeScale = 0; BirdMovement.Instance.isPaused = true; } if (clicks%2!=1){ Time.timeScale = 1; BirdMovement.Instance.isPaused = false; } } } }` when i make one click on the gameobject , the log shows more clicks ( 4-6 more clicks ) . i use this c# script to pause and resume the game , but i can't do that successfully if the clicks are more than the real ones . any suggestion ?

Viewing all articles
Browse latest Browse all 187

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>