- Home /
Moving a game piece with the mouse
My group and I have this gridded board game set up and the way it works is that the player is given a random number between 1-6 (like a dice roll) and then he can move. What we want is for the player to click on a space in the grid using the mouse and the player piece game object will move to that space (either just appearing there or actually moving.) However, we're having some difficulty knowing where to look in the first place for scripting when it comes to mouse clicking for player movement. What is a good place to start?
Answer by GoSuNeem · Nov 23, 2011 at 07:09 PM
If you are looking for mouse click events check out
http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.html
look at all the OnMouse events.
if you are looking for a specific location of where you click, you gotta use
http://unity3d.com/support/documentation/ScriptReference/Camera.html
for screen to ___. I personally like to use Raycasting for checking if I clicked something because I develop mobile games(OnMouse Events don't work for mobile devices).
Hopefully this at least helps out some of your problems.
Good Luck!
Your answer
![](https://koobas.hobune.stream/wayback/20220613052839im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Problem with click-to-move script 0 Answers
Move Camera According to Mouse Movement While Button is Pressed 1 Answer
How to select one prefab from more ? 0 Answers
Having a first person player look at the mouse on the y axis 1 Answer
Problem with Alt + Middle Click Drag for Camera (Windows) 3 Answers