Onirix SDK

Onirix SDK is a source development kit for Unity that allows to create custom or white label applications using Onirix as the AR content provider.

Onirix SDK doesn't require extensive maths or 3D graphics knowledge, it will set up the AR layer for you so you can focus on what's really important, your content. It already comes with a preconfigured solution of a fully working app you can easily extend or modify, check intructions for more details.

See it in action

This is the preconfigured scene (WhiteLabelScene) that comes with the SDK.

If you want to test it on your own Android device, you can download this APK here


How to get Onirix SDK

Onirix SDK distribution is private. If you are interested in creating your own application using Onirix you may write us at info@onirix.com and we will contact you back.

SDK Instructions

You will receive the SDK in the form of a Unity project. It comes with a sample scene called WhiteLabelScene that simulates a white label mobile application for displaying arcade machines in AR.

We recommend to start building new apps by loading this scene and modifying it according to your project needs. A global configuration script is also providing to easily modify the contents of this sample scene.

Setup

  1. Uncompress and open as a Unity project (Unity 2019.2 is the recommended version but it may work from Unity 2018.1 and above)
  2. Load WhiteLabelScene in the editor. (Assets -> Scenes -> WhiteLabelScene).
  3. Select Onirix gameobject in the scene and replace the token from Onirix Auth Manager script with your own purchased SDK token.

  1. Select Config gameobject in the scene and replace with you own app name, logo, colors, fonts, etc.

  1. Run in the editor if you want to preview your UI changes (some AR features don’t work inside the editor).
  2. Switch platform to Android or iOS.
  3. Build and run. (This will take about 10 minutes the first time it is compiled).

View System

In order to organize the UI, Onirix SDK provides a view controller system, coordinated by a NavigationController.

Each screen has its own view prefab and controller script. All views are added to an array inside the OnirixUIManager component of Onirix gameobject.

Some of the provided views are:

  • HomeView: If enabled, it will be the root view of the application. If disabled, it will be skipped and display the projects view.
  • ProjectsView: Generally your SDK token will only give you access to a single project, in that case, this view will be skipped.
  • ModeSelectionView: In the case your selected project contains more than one type of scene, it will allow you to choose between the available scene types.
  • VisorView: This is the AR visor that will display your experiences.

Internationalization

Onirix SDK also provides an internationalization system to manage localized strings.

i18n files are located at WhiteLabelPlayer -> Resources -> translations -> whitelabel_lang.json. By default, you will find english and spanish translations.

There are 2 different ways of internationalizing texts:

  • If it is a Text component inside a gameobject, you may add the TranslatableText component. It will automatically take the key from the text value and provide the translation.
  • Manually, by using the OnirixI18N class.

Manipulating scene elements

The VisorViewController implements the interface IDynamicLoadListener, providing the following callbacks:

  • OnTargetAssetsStartDownloading(Target target);
  • OnTargetAssetsDownloaded(Target target);
  • OnTargetAssetsStartLoading(Target target);
  • OnTargetAssetsLoaded(Target target);
  • OnLoadError(string errorMessage);

Onirix SDK loads the scene elements using the following hierarchy:

  • targets
    • scene_oid_clone_num: Specific instance of the scene. Num will increase each time the scene is instantiated.
      • element_oid: each of the elements in the scene.

If you want to get and manipulate an scene element, you can use the following script:

public void OnTargetAssetsLoaded(Target target)
{

    var targetsRoot = GameObject.Find("Targets");
    var element = target.Elements.First(e => e.Name.Equals("Elem"));
    var elementObject = targetsRoot.transform.FindDeep(element.Oid);

    // Do something with elementObject

}