在我开始之前,我应该提到我是一个统一的noob。Unity键盘没有注册
所以我一直在遵循pong教程,但是我有一个问题。按箭头时,球拍不会移动。如果你知道如何解决这个问题请让我知道
我的代码:
using UnityEngine;
using System.Collections;
public class MoveRacket : MonoBehaviour {
// up and down keys (to be set in the Inspector)
public KeyCode up;
public KeyCode down;
void FixedUpdate() {
// up key pressed?
if (Input.GetKey(up)) {
transform.Translate(new Vector2(0.0f, 0.1f));
}
// down key pressed?
if (Input.GetKey(down)) {
transform.Translate(new Vector2(0.0f, -0.1f));
}
}
}
和控制采摘选项:
你真的从组合框中分配吗? – 2014-10-11 18:00:11
重复问题#http://stackoverflow.com/questions/26318390/key-input-wont-work-in-unity/26318448?noredirect = 1#comment41302388_26318448 不要问问题两次......如果你不能找到你的答案,然后等待几个小时,然后再试一次或在聊天中提问:http://chat.stackoverflow.com/rooms/37624/unity3d-developers – 2014-10-11 19:40:31