ジャイロを有効にしていないだけだった
構成
VR Player
┗ Main Camera
VR Player
に以下のスクリプトをアタッチ
GyroRotate.cs
using UnityEngine;
using System.Collections;
public class GyroRotate : MonoBehaviour {
private Gyroscope gyro;
void Start ()
{
if (SystemInfo.supportsGyroscope)
{
gyro = Input.gyro;
gyro.enabled = true;
}
else
{
Debug.Log("Phone doesen't support");
}
}
void Update ()
{
transform.Rotate (-Input.gyro.rotationRateUnbiased.x, -Input.gyro.rotationRateUnbiased.y, 0);
}
void OnGUI()
{
GUILayout.Label ("Gyroscope attitude : " + gyro.attitude);
}
}
これでUnity側でGame Windowを見ている間、スマホ実機のジャイロを取得して画面を動かすことができる。
参考
【Unity】「Unity Remote 5」の使い方
How to enable head tracking in Gear VR via Unity Remote 5 on android?