我在Unity上做一个简单的乒乓球比赛!这段代码似乎给了我错误。知道我能做些什么来修复它吗?
if (gameObject.name == "Player1") {
transform.Translate (0, Input.GetAxis ("Horizontal") = speed, 0);
} else {
transform.Translate (0, Input.GetAxis ("Vertical") = speed, 0);
}
答案 0 :(得分:1)
试试这个:
if (gameObject.name == "Player1") {
transform.Translate (0, Input.GetAxis ("Horizontal"), 0);
} else {
transform.Translate (0, Input.GetAxis ("Vertical"), 0);
}