Dual Monitor Applications
Available from version 1.4.0 on
The dual monitor functionality is intended to enable the creation of dual monitor applications. Previous implementations required that both screens be full-screen. Using this pipeline, you can have a windowed application on your 2D monitor while rendering a holographic scene on your Looking Glass device. This is achieved by creating an inter-process communicator (IPC) between two Unity applications.
This functionality is a refactor of the Pro Workstation functionality previously in the plugin.
To fully load the example scene:
Holoplay\Examples\7 - Dual Monitor Application
- 2.Select the
DMA BuilderGameObject from the scene hierarchy
- 3.In the
Dual Monitor Application Managerscript, select the
Setup\Open Scenesbutton loads in the
_extendedUIscene of the same name. This scene drives the UI on the 2D window. If a scene doesn't exist by this name, this button will create it.
The additional example scene that gets incorporated includes:
- It's own
DMA Buildergame object, with the
Dual Monitor Application Managerscript field for
Window 2D. This is required so that the scenes can identify which displays they drive.
- A canvas to manage the UI. Any Unity content is allowable here.
- An IPC (inter-process communicator) that sends events between the two scenes.
While it's possible to create your own scene from scratch, the preferred route is by copying the example scenes and removing what you don't need and working from there.
Follow these steps if you'd like to start from scratch.
- 1.Create a New Scene
- 2.Remove the default Unity camera and add a
HoloPlay Captureto the scene, found in
- 3.Add a
DMA Builderto the scene, found in
- 4.Select the
DMA Builderfrom the scene hierarchy, and click
Setup/Open Scene- you'll need to save your scene first
- 5.Add a
DMA Builderto the second scene
- 6.Set the second scene's
Dual Monitor Application's
- 7.Add a
DMA IPCobject to each scene (if cross-application communication is required)
- 8.Set the
Dual Monitor Application Base IPCto
Looking Glassfor the Looking Glass scene, and
Window 2Dfor the 2D scene
- 9.Set the
Inter Process Communicator's
Receiverfor the Looking Glass scene and
Senderfor the 2D scene
- 10.Change the
Inter Process Communicator's
Signing Charto something new that matches in both scenes (recommended)
If the app requires UI elements on the 2D, this can be done using conventional Unity UI elements. There is a prefab provided for you for convenience,
DMA Canvas, though you will need to additionally add an Event System to your scene for Unity UI events.
In order to support all Looking Glass Pro functionality, you must build your applications in an unconventional way. Unity's built-in build pipeline will not work. To build the proper way:
- Open File > Build Settings... and add both your scenes and click Add Open Scenes to add both scenes to the "Scenes in Build" field
- Close the Build Settings window
- Select any
DMA Buildergame object
- Click the Build (Dual Monitor Application) button in the
Dual Monitor Application Managerscript in the inspector
In order to script your own functionality, follow the following steps:
- 1.In your script, add a reference to the
InterProcessCommunicatorin your scene.
- 2.To send data (typically from the 2D UI to the Looking Glass display) call
InterProcessCommunicator.SendDatawith a string as the parameter. This will be sent to the receiver. You can call this function either from a script or from UI events.
- 3.In the receiving scene (typically the Looking Glass scene), in a script, create a reference to the
InterProcessCommunicatorin that scene.
- 4.Create a function named
- 5.This function will now be called when a message is received. Write some logic within this function to handle the various messages the scene will be receiving.
If you have further questions or for further support, please reach out to one of our support specialists by emailing [email protected]