Onirix SDK module

Namespaces


Onirix namespace

This namespace serves as a parent container for all namespaces in the different Onirix SDKs modules but it doesn't contain any code in itself.


Onirix.Core namespace

(enum) SceneLoaderEvent
Description:

This enumeration contains values identifying all the different load events triggered by the OnirixSceneLoader through the provided IOnirixSceneLoaderDelegate.
Values:
AssetsRequested
AssetsDownloaded
SceneLoaded


(interface) IOnirixSceneLoaderDelegate
Description:

The IOnirixSceneLoaderDelegate provides an interface to implement custom delegate objects to listen SceneLoaderEvents through OnirixSceneLoader.
Methods:
OnTargetSceneEvent
Method to be called when a Target triggers a loading event for the scene.
OnSpaceSceneEvent
Method to be called when a Space triggers a loading event for the scene.
OnLoadError
Method to be called when an error is produced loading the target or scene.


(class) OnirixSceneLoader
Description:

The OnirixSceneLoader allows you to download and show in your scene the targets previously designed in Onirix Studio. Each downloaded target is kept in the scene under a hidden node, so that for subsequent requests for the same target, this is just cloned from that target template instead of being downloaded again.
This class is internally used by the OnirixDynamicLoader.
Methods:
OnirixSceneLoader
Constructor.
LoadTargetInScene
Downloads from your Onirix Studio project and instantiates into your scene the target with the given oid.
LoadSpaceScene
Downloads from your Onirix Studio project and instantiates into your scene the space with the given oid.
SetDelegate
Lets you set a delegate that will receive updates during every target or space loading process.

Onirix.Core.Model namespace

This namespace contains all the classes that define the data model used by Onirix Studio, allowing the serialization and deserialization of the information produced during the communication of the SDK with the REST API.

(class) Action
Description:

Represents the consequence to be triggered as a result of an Event.


(class) Asset
Description:

Holds information about a resource (image, model or vídeo).


(class) Datasheet
Description:

Represents an instance of a datastore Template already filled with information.


(class) DatasheetRef
Description:

Represents a reference to an existing Datasheet as given by the GetDatasheets method from the OnirixRestService.


(class) Element
Description:

Represents each one of the nodes present in a Target.


(class) Event
Description:

Represents a condition bound to an Element that is triggering an Action.


(class) Marker
Description:

Represents a picture configured as marker for image recognition.


(class) Project
Description:

Contains information related to an Onirix Studio (targets, spaces or places) project.


(class) Space
Description:

Holds information of an Onirix Studio 3D space reconstruction for Tango powered devices built through the Onirix Constructor app.


(class) SpaceRouteNode
Description:

Represents each one of the nodes constituting a route within a Space.


(class) SpaceRouteWay
Description:

Holds information about a Space route segment conecting two SpaceRouteNode objects.


(class) Target
Description:

A hierarchy of elements that can be referenced together to be instantiated under both surface or image recognition.


(class) Template
Description:

Object defining the data format to be used by a Datasheet.



Onirix.Core.Service namespace

(class) DefaultRestService [: RestServiceBase]
Description:

Implements RestServiceBase providing a consumption interface for the Onirix Studio REST API.
Properties:
ApiUrl [overriden]
Returns the Onirix Studio REST API url.
Methods:
GetProjectOid
Retrieves the Project Oid related to a given Project Token.


(interface) ISpaceLoadingDelegate
Description:

The ISpaceLoadingDelegate provides an interface to implement custom delegate objects to listen several Space loading events through OnirixAssetLoader.
Methods:
OnElementsRequested
Method to be called when all the Space elements has been requested for loading.
OnElementsDownloaded
Method to be called when all the Space elements has been downloaded.
OnElementsLoaded
Method to be called when all the Space elements has been loaded into the scene.


(interface) ITargetLoadingDelegate
Description:

The ITargetLoadingDelegate provides an interface to implement custom delegate objects to listen several Target loading events through OnirixAssetLoader.
Methods:
OnElementsRequested
Method to be called when all the Target elements has been requested for loading.
OnElementsDownloaded
Method to be called when all the Target elements has been downloaded.
OnElementsLoaded
Method to be called when all the Target elements has been loaded into the scene.


(class) OnirixActionHandler [: SingletonBase]
Description:

The OnirixActionHandler is used to execute model Actions in the scene.
Methods:
Do
Executes the given model Action on the specified parent GameObject.


(class) OnirixAssetLoader [: MonoBehaviour]
Description:

The OnirixAssetLoader is responsible for loading Targets and Spaces. This class gets called by the OnirixSceneLoader when performing the scene loading. You can set the inspector fields to whatever objects you want, but the SDK provides prefab objects for all of them and we highly encourage its use.
Inspector fields:
Default 2D Element
Default prefab object to be instantiated when no asset has been set for an Image Element.
Default 3D Element
Default prefab object to be instantiated when no asset has been set for a 3D object Element.
Default Video Element
Default prefab object containing a VideoPlayer component to be instantiated when an Element must display streaming video.
Default Audio Element
Default prefab object containing an AudioSource component to be instantiated when an Element must play streaming audio.
Properties:
Instance [static]
Returns the single OnirixAssetLoader instance.
Methods:
LoadTarget
Performs the loading of the specified Target on the given parent Transform, notifying about the loading progress through the passed ITargetLoadingDelegate.
LoadSpace
Performs the loading of the specified Space on the scene, notifying about the loading progress through the passed ISpaceLoadingDelegate.
DownloadImageAsTexture
Downloads the requested image Asset with the given Oid as a Texture2D. This may be useful for downloading images whose Oid is specified inside a Datasheet.


(class) OnirixAuthManager [: MonoBehaviour]
Description:

The OnirixAuthManager owns the Project Token that must be used for authentication in every interaction with the Onirix Studio REST API.
Inspector fields:
Token
Sets the Project Token that must be used in every interaction with Onirix Studio.
Properties:
Instance [static]
Returns the single OnirixAssetLoader instance.
Token
Sets/gets the Project Token that must be used in every interaction with Onirix Studio.
Methods:
LoadTarget
Performs the loading of the specified Target on the given parent Transform, notifying about the loading progress through the passed ITargetLoadingDelegate.
LoadSpace
Performs the loading of the specified Space on the scene, notifying about the loading progress through the passed ISpaceLoadingDelegate.
DownloadImageAsTexture
Downloads the requested image Asset with the given Oid as a Texture2D. This may be useful for downloading images whose Oid is specified inside a Datasheet.
ReloadSpaceVisibility
Forces the reload of the visibility status established for a given space.


(class) OnirixEventManager [: SingletonBase]
Description:

The OnirixEventManager manages the Event processing for the specified Targets and Spaces. This class gets called by the OnirixSceneLoader during the process of loading a Target or Space, and also by the OnirixRouteService and OnirixTouchManager for triggering click and route Events.
Methods:
LoadTargetEvents
Enables the processing of Events for the given Target instanced as a GameObject with the specified name.
LoadSpaceEvents
Enables the processing of Events for the given Space already instanced in scene.
OnRouteNodeArrived
Reports the OnirixEventManager that a SpaceRouteNode has been reached. This method gets called by the OnirixRouteService.
OnSpaceElementClick
Reports the OnirixEventManager that a Space Element has been interacted. This method gets called by the OnirixTouchManager.
OnTargetElementClick
Reports the OnirixEventManager that a Target Element has been interacted. This method gets called by the OnirixTouchManager.


(static class) OnirixRestService
Description:

The OnirixRestService provides an interface for consumption of the Onirix Studio REST API. You can use the default implementation but also provide any custom implementation deriving from RestServiceBase.
Properties:
Instance [static]
Sets/gets the single OnirixRestService implementation instance. This is, by default, a DefaultRestService object.


(class) OnirixRouteService [: MonoBehaviour]
Description:

The OnirixRouteService loads and shows routes connecting any two points of a Space using the SpaceRouteWays established for it.
Inspector fields:
Line prefab
Asset representing a route segment that will be repeatedly instantiated to build it.
Node prefab
Asset representing an intermediate node for a route.
Destination prefab
Asset representing the ending node for a route.
Properties:
Instance [static]
Returns the single OnirixRouteService instance.
Methods:
LoadRoute [2 overloads]
Builds the optimal route between the two points specified using the provided configuration.


(class) RestError
Description:

Represents an error occurred during a REST call.
Properties:
Code
Sets/gets the error code as long value.
Messages
Sets/gets the error messages as a string[] value.
Methods:
RestError [3 overloads]
Constructor.


(abstract class) RestServiceBase
Description:

The RestServiceBase provides a base class for any implementation for consumption of the Onirix Studio REST API. It already offers implementation for all the documented API methods.
Properties:
ApiUrl [abstract]
Demands that any implementation of a RestServiceBase provides an url for consumption.
Methods:
RestServiceBase
Constructor.
GetAssetData
Queries the Onirix Studio REST API to provide the Asset with the given Oid (or an RestError if the query fails).
GetProjects
Queries the Onirix Studio REST API to provide the Projects currently available as array (or an RestError if the query fails). Except for specific use cases, this array will contain just one element.
GetSpaces
Queries the Onirix Studio REST API to provide all the Spaces in the current Project as array (or an RestError if the query fails).
GetSpace
Queries the Onirix Studio REST API to provide the Space in the current Project with the given Oid (or an RestError if the query fails).
GetTargets
Queries the Onirix Studio REST API to provide all the Targets in the current Project as array (or an RestError if the query fails).
GetTarget
Queries the Onirix Studio REST API to provide the Target in the current Project with the given Oid (or an RestError if the query fails).
GetDatasheet
Queries the Onirix Studio REST API to provide the Datasheet in the current Project with the given Oid (or an RestError if the query fails).
GetTargetDatasheets
Queries the Onirix Studio REST API to provide all the Datasheets added to the Target with the given Oid (or an RestError if the query fails).
GetTargetElementDatasheets
Queries the Onirix Studio REST API to provide all the Datasheets added to the Element with the given Oid belonging the specified Target (or an RestError if the query fails).
GetSpaceDatasheets
Queries the Onirix Studio REST API to provide all the Datasheets added to the Space with the given Oid (or an RestError if the query fails).
GetSpaceElementDatasheets
Queries the Onirix Studio REST API to provide all the Datasheets added to the Element with the given Oid belonging the specified Space (or an RestError if the query fails).
GetUserDatasheets
Queries the Onirix Studio REST API to provide all the Datasheets belonging to a user.
GetProjectOtf
Queries the Onirix Studio REST API to download and save as a local file the otf file for the current Project. The provided Action callback will receive the local file path.
GetSpaceAdf
Queries the Onirix Studio REST API to download and save as a local file the adf file for the Space with the given Oid. The provided Action callback will receive both the adf UUID and the local file path.
GetServerTime
Returns the server time for the last request as TimeSpan.
GetProjectOid [protected][abstract]
Demands that any implementation of a RestServiceBase provides a way to retrieve the Oid for the current Project.
RestCall [protected][2 overloads]
Allows to implement new methods consuming a REST API that returns serialized data in json format. Used exclusively to create new RestServiceBase implementations.


(class) RouteConfig
Description:

A RouteConfig object can be provided to the OnirixRouteService in the LoadRoute method to provide visual customization. This class uses a inner Builder class providing chaining setters and a Build() method for instancing.
Properties:
RoadColor
The color used to tint the route segments.
WaypointColor
The color used to tint the route intermediate nodes.
DestinationColor
The color used to tint the route ending node.
TextFont
The name of the font that will be used to print the destination name.

Onirix.Core.Service.GLTF namespace

This namespace contains classes providing GLTF/GLB 3D file format loading support.

(struct) GLTFLoadingOptions
Description:

A GLTFLoadingOptions object must be provided to the OnirixGLTFLoader filled with the loading configuration.
Properties:
Multithreaded
MaximumLod
Collider
CustomShaderName


(class) OnirixGLTFLoader [: SingletonBase]
Description:

The OnirixGLTFLoader provides a LoadGLTF method returning an IEnumerator to perform GLTF/GLB file loading as a Coroutine. It uses internally a OnirixGLTFSceneImporter to perform the loading operations, and in turn, is used by the OnirixAssetLoader to load the Assets of the Elements.
Methods:
LoadGLTF
Loads the specified GLTF/GLB file with the given configuration. This method can be executed as Coroutine or yielded from one.


(class) OnirixGLTFSceneImporter [: UnityGLTF.GLTFSceneImporter]
Description:

The OnirixGLTFSceneImporter derives from UnityGLTF.GLTFSceneImporter just to provide Vertex Colors support.
Methods:
OnirixGLTFSceneImporter [2 overloads]
Constructor.
ConstructMaterial [protected][override]
Overrides UnityGLTF.ConstructManterial to provide Vertex Colors support.

Onirix.Core.Service.GLTF.UniformMaps namespace

This namespace contains classes used by the OnirixGLTFSceneImporter to properly build the mesh materials including support for vertex colors.

(class) OnirixMetalRoughMap [: OnirixStandardMap]
Description:

Represents a material using the metal/roughness workflow (with vertex colors support).


(class) OnirixSpecGlossMap [: OnirixStandardMap]
Description:

Represents a material using the specular/glossiness workflow (with vertex colors support).


(class) OnirixStandardMap [: UnityGLTF.StandardMap]
Description:

Derives from UnityGLTF.StandardMap to add vertex colors support.

Onirix.Core.Util namespace

(generic class) EventSubscriptor
Description:

The EventSubscriptor is a helper class that offers a simple way to provide a subscription mechanism for different events.
Methods:
EventSubscriptor
Constructor.
operator+
Allows the subscription through the syntax: <eventSubscriptor> += <callback>.
operator-
Allows the unsubscription through the syntax: <eventSubscriptor> -= <callback>.
Invoke
Calls all the subscribed callbacks with the provided argument.
Clear
Removes all subscriptions.


(static class) JsonUtils
Description:

The JsonUtils class is used by the SDK to properly deserialize certain data in json format.
Methods:
ParseJsonData [static]
Parses the given LitJson.JsonData.


(static class) MathUtils
Description:

The MathUtils class is used by the SDK to perform some mathematical calculations.
Methods:
ConvertsThreejsEulerToUnity [static]
Changes the Euler angles provided as a Vector3 parameter from the coordinate system used by Three.js to the one used by Unity.


(class) Scheduler [: MonoBehaviour]
Description:

The Scheduler allows you to schedule the execution of System.Action objects as well as start Coroutines from classes that don't derive from MonoBehaviour.
Properties:
Instance [static]
Returns the single Scheduler instance.
Methods:
PostCoroutine
Starts a Coroutine for the given IEnumerator.
PostAction
Schedules the given System.Action to be executed the next frame.
PostActionDelay
Schedules the given System.Action to be executed after the specified time.

Onirix.SDK namespace

(class) OnirixTouchManager [: MonoBehaviour]
Description:

The OnirixTouchManager is responsible for processing the touches on the screen to detect the Elements from the current Space/Target that the user has interacted with.
Properties:
Instance [static]
Returns the single OnirixTouchManager instance.
OnLongPress
Allows to subscribe to long press events.
OnShortPress
Allows to subscribe to tap events.
Methods:
StartTargetEvents
Starts the touch processing to check for user interactions with Target Elements.
StartSpaceEvents
Starts the touch processing to check for user interactions with Space Elements.
GetTouchedSpaceElement
Returns the GameObject representing a Space Element that has been touched by the given Touch (or null if none has been affected).
GetTouchedTargetElement
Returns the GameObject representing a Target Element that has been touched by the given Touch (or null if none has been affected).


(class) OnirixVideoContainer [: MonoBehaviour]
Description:

The OnirixVideoContainer is a helper class used to automatically toggle the video playback status when the related GameObject gets touched.
Inspector fields:
Hide On Play
Sets the GameObject nodes that must be hidden during the video playback.
Methods:
OnClick
This method gets called by the OnTouch helper class to toggle the video playback status.


(class) OnTouch [: MonoBehaviour]
Description:

The OnTouch is a helper class internally used by the OnirixTouchManager to notify the VideoContainer about touches.
Inspector fields:
OnClick
UnityEvent to be invoked.
Methods:
Touch
Invokes the UnityEvent set through the inspector.

Onirix.SDK.StarterKit namespace

This namespace contains helper classes used in the bundled OnirixScene to provide from the beginning a functional application. These clases are not meant to be used in a final app.

(class) OnirixDefaultController [: MonoBehaviour]
Description:

The OnirixDefaultController provides an entry point for the bundled OnirixScene that configures the screen to never sleep and pushes the OnirixStarterKitViewController controller.


(class) OnirixStarterKitViewController [: UIViewController]
Description:

The OnirixStarterKitViewController implements a dummy UIViewController that reacts to the user touches by changing its background color.

Onirix.SDK.UI namespace

This namespace contains classes implementing a MVC pattern to provide a convenient way to build and display user interfaces and its behaviours.

(class) OnirixUIManager [: MonoBehaviour]
Description:

The OnirixUIManager is the entry point for the user interface system. It provides the functionality to create and get UINavigationController objects, as well as create the View objects containing UIViewController components with their behaviour.
Inspector fields:
Views
Array containing all the View prefabs that the OnirixUIManager can instantiate.
CanvasPrefab
Default prefab object containing a Canvas already configured with the desired behaviour. A DefaultCanvas prefab is already provided with the SDK.
Properties:
Instance [static]
Returns the single OnirixUIManager instance.
DefaultNavigationController
Returns the UINavigationController created by default during app startup.
indexer[ ]
Returns the UINavigationController with the specified name. Must be previously created by calling CreateNavigationController.
Methods:
CreateNavigationController
Creates a new UINavigationController with the given name and priority. A UINavigationController with higher value for the priority is drawn on top of those with lower values.
NavigationControllerExists
Checks if a UINavigationController with the specified name exists.
DestroyNavigationController
Destroys the UINavigationController with the specified name.
CreateView
Instantiates and returns the View prefab with the given index in the OnirixUIManager Views array (available through the inspector).


(class) UINavigationController [: MonoBehaviour]
Description:

The UINavigationController is a container for UIViewControllerobjects that defines a stack-based scheme for navigating between them. When using a new Canvas different from the provided DefaultCanvas this script must be attached to it so that the OnirixUIManager is able to manage it.
Typically your app will have only one UINavigationController, but this is not mandatory. You can create and use through the OnirixUIManager as many UINavigationController as you need to achieve the user interface your application requires. You could want to make some UI elements to remain always visible as overlay on top of every screen in your application during its whole life-cycle, and this is a situation where having several UINavigationController could be useful.
Methods:
OnBack
This method is called by the OnirixUIManager. You should never call this method directly.
PushView
Pushes the UIViewController attached as component of the given View GameObject on the top of the UINavigationController stack.
PushViewController
Pushes the given UIViewController on the top of the UINavigationController stack.
PopViewController
Removes the UIViewController currently on top of the UINavigationController hierarchy.
GetTopViewController
Returns the UIViewController currently on top of the UINavigationController hierarchy
GetViewControllers
Returns all the UIViewControllers in the UINavigationController as a stack collection.


(class) UIViewController [: MonoBehaviour]
Description:

When building screens for our app, we will design them in Unity with UI GameObject elements (conventionally but not mandatorily using a Panel as root) saving the resulting hierarchy as a prefab. This is what we call the View. Attached to this View we will include a script deriving from UIViewController that will act as behaviour for this screen. This class has several public properties and overridable methods that we must know to develop our app screens properly.
Properties:
NavigationController
Returns the UINavigationController in which the UIViewController is stacked.
Focused
Returns true when the View is currently active, on the top of the UINavigationController hierarchy (false otherwise).
View
Returns the root GameObject element of the view's hierarchy. It works as an alias for the gameObject property.
Methods:
OnEntersBackground
Gets called as soon as the UIViewController turns inactive because another one has been placed on top in the same UINavigationController hierarchy
OnEntersForeground
Gets called when the UIViewController gets activated on top of the UINavigationController hierarchy, both if it has just been pushed or if any controllers placed on top of this one has been removed. This method takes a boolean parameter for differencing between this two options.
OnPopped
Gets called when the UIViewController is about to get removed from the UINavigationController hierarchy.
OnBack
Gets called when the user presses the device back key. The default behaviour will make this UIViewController to get removed from the UINavigationController hierarchy.

Onirix.SDK.Util namespace

This namespace contains several utility classes.

(generic class) ObjRef
Description:

This helper class wraps an object allowing to pass it by reference even if it is a value type.
Properties:
Value
Sets/gets the ObjRef wrapped object.


(static class) ToastHelper
Description:

This helper class allows to display toast notifications.
Methods:
ShowToast
Shows the given message as a toast notification.