-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAutoDeviceSimulator.cs
More file actions
36 lines (25 loc) · 975 Bytes
/
AutoDeviceSimulator.cs
File metadata and controls
36 lines (25 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using UnityEngine;
public class AutoDeviceSimulator : MonoBehaviour
{
#if UNITY_EDITOR
[SerializeField] private GameObject deviceSimulator;
private void Awake()
{
if (GameObject.Find("XR Device Simulator(Clone)") == null)
{
DontDestroyOnLoad(Instantiate(deviceSimulator));
}
}
#endif
}
/*
How to use:
1. Attach this script to any game object.
2. In the "deviceSimulator" field in the "Inspector" window, assign the "XR Device Simulator" prefab from "Samples/XR Interaction Toolkit/_YOUR_VERSION_/XR Device Simulator/" folder.
Documentation:
- The "deviceSimulator" variable is a reference to the "XR Device Simulator" prefab.
Comment:
- To use this script, check if the XR Interaction Toolkit with XR Device Simulator is installed in your project.
- This script automatically creates a XR Device Simulator object on your game scene only in Unity editor mode.
- This script designed for AR/MR/VR games.
*/