unity 3d 通过按下按键,来改变脚本里某变量的值,怎么做? 5
展开全部
Input.Getkey()
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour {
void Update() {
if (Input.GetKey("up"))
print("up arrow key is held down");
if (Input.GetKey("down"))
print("down arrow key is held down");
}
}
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour {
void Update() {
if (Input.GetKey("up"))
print("up arrow key is held down");
if (Input.GetKey("down"))
print("down arrow key is held down");
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询