Files
BeatSaber/Assets/Script/XRSimulatorLoader.cs
T

38 lines
1.4 KiB
C#
Raw Normal View History

using UnityEngine;
/// <summary>
/// Quest가 아닌 환경(에디터, PC)에서 XR Interaction Simulator를 자동으로 로드합니다.
///
/// 설정 방법:
/// 1. Intro 씬의 XR Origin (또는 임의 GameObject)에 이 스크립트를 추가
/// 2. SimulatorPrefab 필드에 아래 경로의 프리팹을 연결:
/// Assets/Samples/XR Interaction Toolkit/3.3.1/XR Interaction Simulator/XR Interaction Simulator.prefab
///
/// 조작법 (XR Interaction Simulator):
/// - 마우스 우클릭 드래그 : 머리 방향 회전
/// - G 키 누른 채 마우스 이동 : 오른손 컨트롤러 이동
/// - Shift+G : 왼손 컨트롤러
/// - Space : 트리거(UI 클릭)
/// </summary>
public class XRSimulatorLoader : MonoBehaviour
{
[SerializeField] private GameObject simulatorPrefab;
private void Awake()
{
#if !UNITY_ANDROID || UNITY_EDITOR
if (simulatorPrefab != null)
{
Instantiate(simulatorPrefab);
Debug.Log("[XRSimulatorLoader] XR Interaction Simulator 시작");
}
else
{
Debug.LogWarning("[XRSimulatorLoader] simulatorPrefab이 비어 있습니다.\n" +
"Inspector에서 XR Interaction Simulator.prefab을 연결하세요.\n" +
"경로: Assets/Samples/XR Interaction Toolkit/3.3.1/XR Interaction Simulator/XR Interaction Simulator.prefab");
}
#endif
}
}