「Unity VR」を利用せず、もう一つの方法として、「Dive Unity Plugin Package 2.1.5」を利用してVRを作成する方法の説明動画です。「Dive Unity Plugin Package 2.1.5」を利用しても簡単に作成できます。
【動画】
■おすすめVRゴーグル
![]() | オキュラス Oculus Quest 2 64GB オールインワンVRヘッドセット[納期未定 ご用意出来次第の発送] 価格:37,180円 |

![]() | オキュラス 【納期未定 入荷次第順次出荷】Oculus Quest 2 256GB オールインワンVRヘッドセット 価格:49,280円 |

「Dive_Camera」にジャイロスクリプトを追加
下記コードを「Dive_Camera」に追加します。
※名前は「vrcamera」で作成しましたが、任意となっています。
---------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class vrcamera : MonoBehaviour
{
Quaternion currentGyro;
void Start()
{
Input.gyro.enabled = true;
}
void Update()
{
currentGyro = Input.gyro.attitude;
this.transform.localRotation =
Quaternion.Euler(90, 90, 0) * (new Quaternion(-currentGyro.x, -currentGyro.y, currentGyro.z, currentGyro.w));
}
}
「NO GYRO!」エラーが表示される対応
「no gyro please use other phone for proper head tracking」の表示された場合、ジャイロセンサーがないのでエラーが表示される?原因は確認していませんが、表示させない対応として「OpenDiveSensor」スプリクトの下記部分を削除するとコメントアウトすると表示しなくなります。
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
void OnGUI()
{
if(mbShowErrorMessage){
if(GUI.Button(new Rect(0, 0, Screen.width, Screen.height), "button"))
mbShowErrorMessage = false;
if(NoGyroTexture != null){
int liHeight = (int)(Screen.height * 0.9);
GUI.DrawTexture(new Rect((Screen.width - liHeight) / 2,(Screen.height - liHeight) / 2, liHeight,
liHeight), NoGyroTexture, ScaleMode.StretchToFill, true, 0); }
}
}
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
参考サイト:https://freesworder.net/dive-camera-error/