1.设置用户输入
Edit -> Project Setting -> Input 设置游戏输入
2.脚本中检测用户输入
Input.GetAxis返回的值 -1 到 1 判断有没有输入
Input.GetAxis("Horizontal") * transform.right + Input.GetAxis("Vertical") *transform.forward;
Input.GetMouseButtonUp(0) 鼠标操作
Input.touches ... Input.touchcount 判断手机触摸
通过射线Ray 和 Collidor 判断移动到的位置