Unityスクリプト上でBackKeyは「KeyCode.Escape」になる。
でもあんまり行儀のいいコードでは無いような気がする
#if UNITY_WINRT if (Input.GetKey(KeyCode.Escape)) { Application.Quit(); } #endif
※これは間違い
Main.csにBackキーをとるためのコードをMainPage関数に追加したものの、発生しない模様
public MainPage(SplashScreen splashScreen) { … #if UNITY_WP_8_1 Windows.Phone.UI.Input.HardwareButtons.BackPressed += (sender, e) => { Frame frame = Window.Current.Content as Frame; if (frame == null) { return; } if (frame.CanGoBack) { frame.GoBack(); e.Handled = true; } }; #endif }
傾き検出
全部テスト
いくつか機能しない、実機では「Input.gyro.enabled」をtrueにしていても「False」と表示される
void Start () { Input.gyro.enabled = true; Input.gyro.updateInterval = 0.01F; } // Update is called once per frame void Update () { var gyroText = "enabled : " + Input.gyro.enabled.ToString() + Environment.NewLine; gyroText += "attitude : " + Input.gyro.attitude.ToString() + Environment.NewLine; gyroText += "gravity : " + Input.gyro.gravity.ToString() + Environment.NewLine; gyroText += "rotationRate : " + Input.gyro.rotationRate.ToString() + Environment.NewLine; gyroText += "rotationRateUnbiased : " + Input.gyro.rotationRateUnbiased.ToString() + Environment.NewLine; gyroText += "updateInterval : " + Input.gyro.updateInterval.ToString() + Environment.NewLine; gyroText += "userAcceleration : " + Input.gyro.userAcceleration.ToString() + Environment.NewLine; guiText.text = gyroText; }
Unity-chanの表示がおかしいですが、これはWindowsPhone8.1(実機)がカスタムシェーダーに対応していないためです。
マテリアルを改良または取り去れば、きちんと表示されるはずです