Cryptic Cabinet is a short Mixed Reality experience designed for Meta Quest 2, Quest Pro and Quest 3 headsets.
It demonstrates the possibilities of MR using the Meta SDK packages for Unity, and implements multiplayer scenarios using Photon Fusion in combination with Meta's shared spatial anchors APIs. This project adapts to your physical room (big or small) to create a unique experience for everyone.
This codebase is available both as a reference and as a template for MR projects.
The majority of Cryptic Cabinet is licensed under MIT LICENSE, however files from Text Mesh Pro, and Photon SDK, are licensed under their respective licensing terms.
See the CONTRIBUTING file for how to help out.
This project was built using the Unity engine with Photon Fusion.
Test the game on AppLab - Cryptic Cabinet.
-
Configure the project with Meta Quest and Photon
-
Make sure you're using Unity 2022.3.16f1 or newer.
-
Load the scene Assets/CrypticCabinet/Scenes/MainScene.unity
-
To test in Editor you will need to use Quest Link:
Quest Link
- In the Oculus desktop app navigate to the Beta Settings Settings -> Beta and enable the following settings:
- Developer runtime features
- Pass-through over Oculus Link
- Share point cloud over Oculus Link
- Enable Quest Link:
- Put on your headset and navigate to "Quick Settings"; select "Quest Link" (or "Quest Air Link" if using Air Link).
- Select your desktop from the list and then select, "Launch". This will launch the Quest Link app, allowing you to control your desktop from your headset.
- With the headset on, select "Desktop" from the control panel in front of you. You should be able to see your desktop in VR!
- Navigate to Unity and press "Play" - the application should launch on your headset automatically.
- In the Oculus desktop app navigate to the Beta Settings Settings -> Beta and enable the following settings:
-
To test in Editor as a guest the simulator can be used
Enabling the Simulator
- Select Meta -> Simulator -> Enable Simulator
- Press Play
- The simulator should open a new window (Simulator Docs)
The project is organically structured to distinguish the main components of the MR experience's logic. A breakdown of the core features is defined on the Main Scene under the "CrypticCabinetLogic" GameObject.
The CrypticCabinetLogic contains the following core objects:
-
ColocationManager, which is responsible for colocating multiple players within the same room, and to keep a single player aligned to the real room throughout the gameplay. For more information, check the documentation inside the ColocationManager script.
-
ConnectionManager, which handles the Photon Fusion connection workflows for single and multiplayer sessions. The PhotonConnector logic showcases how a shared multiplayer session is handled via Photon Fusion, how the creation of shared rooms and lobbies work, and how the connection states can be handled accordingly.
-
PassthroughManager, which is responsible for the Color LUT effects applied to the passthrough of the supported Quest headsets. During the gameplay, this feature is showcased when interacting with the UV machine puzzle and the light beam hitting the glass globe in the Orrery puzzle. Additional functions are implemented inside the PassthroughConfigurator and PassthroughChanger as an example of customized effects using Meta's Color LUT APIs from the SDK.
-
SceneManagement, which holds the logic to use the Scene Understanding API from the SDK to configure the virtual objects placements around the real room of the player, allowing their tweaking when desired.
-
GameManager, which controls the game phases flow of the gameplay.
-
Player, which holds the logic for all the interactions a player can perform across the whole experience. This showcases how the Meta Interaction SDK can be used to simplify usability for XR scenarios.
An explanation of some of the mechanics and features of the app can be found in the Feature Overview page.
The GameManager script controls the game phases of the gameplay. Each game phase is responsible for a specific task of the game:
- ObjectSpawningGamePhase handles the scene setup via the scene understanding APIs to tweak the placements for the virtual objects around the room before starting the gameplay;
- WaitForGuestPhase waits for Guest players that want to join a multiplayer game before the gameplay starts;
- Act1TimelinePhase starts the intro animation of the gameplay;
- PuzzleLoadingGamePhase spawns the interactive objects around the room after the intro animation has finished playing;
- Act3TimelinePhase starts the outro animation once the gameplay completes and all puzzles are resolved.
The main UI for the application is defined through the UIModalWindow prefab, which is controlled by the UISystem script.
This script conveniently defines a singleton object that any class in the game can interact with to trigger UI messages and callbacks.
First, ensure you have Git LFS installed by running this command:
git lfs install
Then, clone this repo using the "Code" button above, or this command:
git clone https://github.com/oculus-samples/Unity-CrypticCabinet.git
Within the repo there's detailed Doxygen docs for the code in Documentation/docs/html/index.html. This can be opened in a web browser once the code has been cloned.
This project makes use of the following plugins and software:
- Unity 2022.3.16f1 or newer
- Meta XR Utilities
- Meta XR Platform SDK
- Meta XR Interaction SDK
- Meta XR Simulator (Used for test multi-user)
- Photon Fusion
- UniTask
The following is required to test this project within Unity: