Quantcast
Channel: Questions in topic: "left"
Viewing all articles
Browse latest Browse all 135

Unity 4 C-Sharp Do Something when I hold left click on a specific object?

$
0
0
Hi, I'm relatively new to Unity as well as C-Sharp, and im trying to make a game for mobile in which there are 3 controls on screen. An arrow facing right, one facing left, and one facing up. What I wish to achieve is when the player holds their finger on the right arrow button (IE GetMouseButton(0)) The in-game player will move to the right at a certain rate. I have been searching around trying to find answers, and most come to the idea of Raycasting, which I have never used before. Basically, if someone could tell me how to do something only when the user holds the mouse button down on ONE SPECIFIC OBJECT, something will happen. Also, the buttons never move, they will stay on screen at all times. Just for some more information, this is a 2D based game, and I have a Box Collider 2D on each of my 3 buttons, if that makes a difference. Thanks!

Viewing all articles
Browse latest Browse all 135


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