Input.anyKey 任意键?

static var anyKey : bool

Description描述

Is any key or mouse button currently held down? (Read Only)

是否有某一按键或鼠标按钮此时被按住?(只读)

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Update() {
		if (Input.anyKey)
			Debug.Log("A key or mouse click has been detected");

	}
}
// Detects if any key has been pressed.
//检测是否某一按键被按住

function Update() {
	if(Input.anyKey)
		Debug.Log("A key or mouse click has been detected");
}
最后修改:2011年3月11日 Friday 18:33

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。