LoveLogicAI commited on
Commit
cd0d181
Β·
verified Β·
1 Parent(s): 8b80230

unity setup guide

Browse files
Files changed (1) hide show
  1. UNITY_SETUP.md +103 -0
UNITY_SETUP.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # XROS Shell β€” Unity (Quest 3) Setup Guide
2
+
3
+ This guide assembles the Unity frontend for the spatial OS shell. The backend
4
+ (Python) runs on your computer; the Quest 3 app is a thin client that renders
5
+ spatial panels and hosts the terminal.
6
+
7
+ ## Architecture
8
+
9
+ ```
10
+ Quest 3 (Unity) Your computer (Python)
11
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
12
+ β”‚ WorldPanelManager │◄──spawn/move── xros_server.py β”‚
13
+ β”‚ (spatial panels) β”‚ /remove β”‚ β”œβ”€ WorldState β”‚
14
+ β”‚ SpatialShellTerminal │──command─────►│ └─ SpatialShell β”‚
15
+ β”‚ (terminal panel) │◄──output─────── (spawn/move/ls/gen)β”‚
16
+ β”‚ XrosClient (WebSocket) β”‚ β”‚ β”‚
17
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
18
+ ```
19
+
20
+ ## 1. Prerequisites
21
+
22
+ - **Unity 2022.3 LTS** (or newer) with **Android Build Support** module.
23
+ - **Meta XR All-in-One SDK** (or Core SDK) β€” via the Unity Package Manager.
24
+ - **Quest 3** in **Developer Mode** (Meta Horizon app β†’ Settings β†’ Developer).
25
+ - **Python 3.11+** on your computer, with `websockets` installed
26
+ (`pip install websockets`).
27
+
28
+ ## 2. Create the project
29
+
30
+ 1. New project β†’ **3D (URP)** template.
31
+ 2. **File β†’ Build Settings β†’ Android β†’ Switch Platform**.
32
+ 3. **Edit β†’ Project Settings β†’ Player β†’ Other Settings**:
33
+ - Set **Minimum API Level** to 29+ (Quest 3 requires 32).
34
+ - Set **Scripting Backend** to IL2CPP, **Target Architectures** ARM64.
35
+ 4. **Package Manager** β†’ add **Newtonsoft Json**
36
+ (`com.unity.nuget.newtonsoft-json`) β€” required by `XrosClient.cs`.
37
+ 5. **Package Manager** β†’ add **TextMeshPro** (import TMP Essentials when prompted).
38
+
39
+ ## 3. Import Meta XR SDK
40
+
41
+ 1. **Package Manager β†’ Add package by name**:
42
+ `com.meta.xr.sdk.all` (All-in-One) β€” or `com.meta.xr.sdk.core` for the minimum.
43
+ 2. **Edit β†’ Project Settings β†’ XR Plug-in Management** β†’ install **OpenXR**,
44
+ enable it for Android, and add **Meta Quest Support**.
45
+ 3. **Edit β†’ Project Settings β†’ Oculus** β†’ enable **Passthrough** and
46
+ **Hand Tracking** (or use the Meta XR setup wizard).
47
+
48
+ ## 4. Build the scene
49
+
50
+ 1. Delete the default camera. Add **OVRCameraRig** (Meta XR β†’ OVRCameraRig).
51
+ 2. Add an **OVRPassthroughLayer** to the rig's CenterEyeAnchor for passthrough.
52
+ 3. Add **OVRHand** components (left + right) to the rig for hand tracking.
53
+ 4. Create an empty GameObject **"XROS"** and add the three scripts:
54
+ - `XrosClient.cs`
55
+ - `WorldPanelManager.cs`
56
+ - `SpatialShellTerminal.cs`
57
+
58
+ ## 5. Terminal panel UI
59
+
60
+ 1. Under the rig, create a **Canvas** (World Space), size ~0.8 Γ— 0.5 m,
61
+ positioned ~1.5 m in front of the user.
62
+ 2. Add a **TMP_InputField** (the command line) and a **TMP_Text** (the output
63
+ log) as children.
64
+ 3. On `SpatialShellTerminal`, assign `client` (the XrosClient), `input`, and
65
+ `output`. Wire the input field's **OnSubmit** to `Submit()`.
66
+
67
+ ## 6. Panel prefab
68
+
69
+ 1. Create a **Quad** (or a small World-Space Canvas) with a **TMP_Text** child
70
+ named "Title".
71
+ 2. Save it as a prefab and assign it to `WorldPanelManager.panelPrefab`.
72
+
73
+ ## 7. Point the client at your backend
74
+
75
+ 1. Find your computer's **LAN IP** (`ipconfig` / `ifconfig`).
76
+ 2. On `XrosClient`, set `serverUrl` to `ws://<your-lan-ip>:8765`.
77
+ 3. Start the backend on your computer:
78
+ `python xros_server.py --host 0.0.0.0 --port 8765`
79
+ 4. Ensure the Quest and your computer are on the **same Wi-Fi network**.
80
+
81
+ ## 8. Build & run
82
+
83
+ 1. **File β†’ Build Settings β†’ Build And Run** with the Quest connected via USB
84
+ (or use **Quest Link** / **Air Link** for fast iteration).
85
+ 2. Put on the headset. You should see passthrough, the terminal panel, and
86
+ your hands.
87
+ 3. Type in the terminal:
88
+ - `help`
89
+ - `spawn panel --title "Hello world"`
90
+ - `gen a clock for the wall`
91
+ - `ls`
92
+
93
+ A panel should appear in the room for each `spawn`/`gen`, driven by the shared
94
+ world model on your computer.
95
+
96
+ ## Troubleshooting
97
+
98
+ - **No connection**: check the LAN IP, that the backend is running with
99
+ `--host 0.0.0.0`, and that both devices are on the same network.
100
+ - **No passthrough**: enable Passthrough in Project Settings β†’ Oculus, and add
101
+ the OVRPassthroughLayer.
102
+ - **No hands**: enable Hand Tracking and add OVRHand components.
103
+ - **JSON errors**: confirm Newtonsoft Json is installed in the Package Manager.