C# scripts from an NYU Abu Dhabi VR campus-tour coursework prototype. The tour moves between 360° scenes using a graph of 156 campus waypoints.
This is a script supplement, not an importable Unity project. Scenes, photographs, prefabs, .meta files, package manifests, and headset builds are not included. You need your own scene assets and Unity project to run it.
| Script | Responsibility |
|---|---|
CampusRoutes.cs |
156 waypoints and 345 enabled directional connections; pure C# lookup |
Teleporter.cs |
Responds to navigation-arrow collisions and requests a scene change |
CampusSceneLoader.cs |
Checks that a scene is available before loading it |
PlayerPrefSetter.cs |
Stores the current scene's waypoint ID; rejects invalid IDs |
ButtonFunctions.cs |
Start tour, toggle About text, and quit |
MainMenuSceneSwitcher.cs |
Return to the Main Menu scene |
PlayerController.cs |
Thumbstick translation and rotation through OVRInput; provided controller credited below |
Unknown states, disabled directions, missing scenes, and unrelated collisions do not navigate. A successful transition ignores subsequent triggers on the same component.
The controller depends on the Oculus/Meta package that supplies OVRInput. These scripts do not use XR Interaction Toolkit. The original Unity/package versions are not recorded, so no specific editor or headset configuration is certified here.
- Put the root C# files into your project's
Assets/Scriptsfolder. Keep thetestsdirectory outsideAssets; it contains standalone test doubles. - Add each destination scene to Build Settings using the exact names in
CampusRoutes.cs. AddMain Menuand the initial scene1_WC_to_Palms. - Add
PlayerPrefSetterto each waypoint scene and setglobalStateValueto its ID, such as1,101, or203.1. docs/scenes.csv maps every destination scene to its ID, including the two204_scenes with different IDs. The empty default intentionally reports a configuration error. - Attach
Teleporterto the object that enters the navigation triggers. Configure Unity colliders/rigidbodies to receiveOnTriggerEnter. Arrow objects need theNavigationArrowtag and one of these exact names:ForwardButton,BackwardButton,LeftButton,RightButton. - Wire menu buttons to
ButtonFunctionsandMainMenuSceneSwitcher; assign the About text object in the Inspector. - If using the supplied controller, attach
PlayerControllerto the rig. Its right stick translates in world axes; its left stick rotates. It has no collision-aware locomotion or raycast selection.
With .NET 8:
dotnet run --project tests/NavigationTests.csproj --configuration ReleaseCI compiles all root scripts against minimal Unity/OVR test doubles and checks graph integrity, invalid states, disabled routes, missing scenes, and duplicate triggers. This verifies navigation logic only. Unity Play Mode, scene wiring, rendering, controller input, and headset comfort still need testing in a complete project.
Ashmit Mukherjee's coursework repository. PlayerController.cs retains its original Pi Ko, 24 September 2023 author header; it is not claimed as Ashmit's original implementation. See ATTRIBUTION.md for the limits of the included license.