Skip to main content

Unity

info

Supported Versions: Unity 2021.3 LTS, Unity 2022.3 LTS, Unity 2023.1

How to install

Plugin Installation

The plugin is currently only available to ZeroLight partners. To become one, get in touch here. If you are a ZeroLight partner, please follow the instructions here.

Project Setup

  1. Create a new folder named "ZeroLight OmniStream" inside the "Packages" folder in your Unity Project
  2. Copy the contents from the plugins\Unity folder from your plugin download into this new folder
  3. Unity will detect the package and import it automatically
  4. With your project's main scene open click Add OmniStream to scene within the ZeroLight menu
  5. You'll see the ZLCloudPluginModule GameObject has been added to your scene
Note

The ZLCloudPluginModule GameObject automatically gets added to DontDestroyOnLoad so it will persist between Scene changes. If you use Scene reloads as a method of resetting state between connections, then ensure that the GameObjects linked in any events are aslo added to DontDestroyOnLoad, otherwise the links will be broken on Scene reload

Key Bindings

For security reasons, OmniStream does not pass through all input from the web broweser, keys have to be explciitly enabled in the plugin settings. A selection of standard keys (WASD etc.) are inclided by default, these can be removed or extra keys added in the Allowed Keys List. To add keys to the Allowed Keys list, press the record button, hit the keys you wish to add on the keyboard, and press stop. Alternatively uoi can manually enter ASCII key codes using an online tool such as https://keycode.info/ to find the relevant code.

Pmnistream settings menu

Legacy Input System

The Unity Legacy Input System is supported, but does have issues with mouse input when testing locally (due to the way Unity captures the mouse in the legacy system). If practical for your project, we recomend swithcing to the new Input System, which is the default when you install the OmkniStream plugin. To swithc to the Legacy Input System, use the Input Mode dropdown in the OmniStream settings menu.

Events

Unity Events

Connected

On Connected Stream

Triggered when a user connects to a stream. This is where the experience should be started, into camera sequences triggered, onboarding information displayed etc.

Disconnected

On Disconnected Stream

Triggered when a user disconnects from a stream for any reason (e.g. browser close, connection drop). This is where any cleanup/resetting of the experience needs to be done, so the experience is ready when the next user connects. When debugging locally the OmniStream systems that normally call this do not run, to simulate this from the browser, call cloudstream.disconnect() from the browser console.

Receive Data

On Receive Data

Where messages sent from the web page hosting the stream are received. The content of these messages is JSON data, but the schema for the data is not defined by ZeroLight and can be used for whatever data makes sense for your experience. Examples might include UI that is outside of the stream, or for the user to pass some custom text to the experience.

Send Data

Send Data

Messages can be sent to the web page hosting the stream. As with Receive Data the content of the messages is an open JSON schema. This can be used to let the web page hosting the stream know something has happened in the experience.

ZLCloudPluginModule.SendData({"key":"value"})