//捕获Android的系统返回键
public class MainCamera : MonoBehaviour {
public GameObject dialog;
// Use this for initialization
void Start () { }
// Update is called once per frame void Update ()
{
if (Application.platform == RuntimePlatform.Android && (Input.GetKeyDown (KeyCode.Escape))) { dialog.SetActive (true);}
}
public void IsQuit (bool quit) { if (quit) { Application.Quit (); } }
}
博客给出了一段代码用于捕获Android的系统返回键。代码定义了一个名为MainCamera的类,在Update方法中判断当前平台为Android且按下返回键时,将对话框激活,还提供了退出应用的方法。
2542

被折叠的 条评论
为什么被折叠?



