UxrManager Class

Main manager in the UltimateXR framework. As a UxrSingleton it can be accessed at any point in the application through UxrManager.Instance . It can be pre-instantiated in the scene in order to change default parameters through the inspector but it is not required. When accessing the global UxrManager.Instance, if no UxrManager is currently available, one will be instantiated in the scene as the global Singleton.

UxrManager is responsible for updating all key framework entities such as avatars each frame in the correct order. Events and callbacks are provided so that custom updates can be executed at appropriate stages of the updating process.

UxrManager also provides commonly required functionality:  

  • Pre-caching prefabs when scenes are loaded to eliminate hiccups.
  • Moving/rotating/teleporting avatars.
  • Provide events to notify when avatars have been moved/rotated/teleported.
  • Provide events to notify before and after updating a frame and at different stages of the updating process for finer control.

Inheritance Hierarchy

System.Object
  Object
    Component
      Behaviour
        MonoBehaviour
          UltimateXR.Core.Components.UxrComponent
            UltimateXR.Core.Components.Singleton.UxrAbstractSingleton(UxrManager)
              UltimateXR.Core.Components.Singleton.UxrSingleton(UxrManager)
                UltimateXR.Core.UxrManager
Namespace: UltimateXR.Core
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public sealed class UxrManager : UxrSingleton<UxrManager>


The UxrManager type exposes the following members.

Constructors

NameDescription
Public methodUxrManager

Properties

NameDescription
Public propertyIsPrecaching Gets whether the manager is currently pre-caching. This happens right after the local avatar is enabled and UsePrecaching is set.
Public propertyPostUpdateMode Gets or sets when to perform the post-update. The post-update updates among others the avatar animation (hand poses, manipulation mechanics and Inverse Kinematics). It is LateUpdate by default to make sure they are played on top of any animation generated by Unity built-in animation components like Animator.
Public propertyPrecacheFrameCount Gets or sets the number of frames pre-cached objects are shown. These frames are drawn in black and right after the scene will fade in, so that pre-caching is hidden to the user.
Public propertyTeleportFadeColor Gets or sets the color used when teleporting using screen fading transitions.
Public propertyUsePrecaching Gets or sets whether the manager uses pre-caching. Pre-caching happens right after the local avatar is enabled and consists of instantiating objects described in all IUxrPrecacheable components in the scene. These objects are placed right in front of the camera while it is faded black, so that they can’t be seen, which forces their resources to be loaded in order to reduce hiccups when they need to be instantiated during the session. After that they are deleted and the scene is faded in.

Methods

NameDescription
Public methodStatic memberLogMissingAvatarInHierarchyError Given a component that requires an UxrAvatar component in the hierarchy in order to work, logs an error indicating that it’s missing.
Public methodStatic memberLogMissingAvatarInScene Given a component that requires an UxrAvatar component in the scene in order to work, logs an error indicating that it’s missing.
Public methodMoveAvatarTo(UxrAvatar, Single, Boolean) Moves the avatar to a new floor level.
Public methodMoveAvatarTo(UxrAvatar, Transform, Boolean) See MoveAvatarTo.
Public methodMoveAvatarTo(UxrAvatar, Vector3, Boolean) Moves an avatar to a new position on the floor, keeping the same viewing direction. The eye level is maintained.
Public methodMoveAvatarTo(UxrAvatar, Vector3, Vector3, Boolean) Moves an avatar to a new position on the floor and a viewing direction. The eye level is maintained.
Public methodRotateAvatar Rotates the avatar around its vertical axis, where a positive angle turns it to the right and a negative angle to the left.
Public methodRotateLocalAvatar Rotates the local avatar around its vertical axis, where a positive angle turns it to the right and a negative angle to the left. The rotation can be performed in different ways using rotationType.
Public methodRotateLocalAvatarAsync

Asynchronous version of RotateLocalAvatar(Single, UxrRotationType, Single, Action, Action(Boolean), Boolean).

Rotates the local avatar around its vertical axis, where a positive angle turns it to the right and a negative angle to the left. The rotation can be performed in different ways using rotationType.

Public methodRotateLocalAvatarCoroutine Public avatar rotation coroutine that can be yielded from an external coroutine. Rotates the avatar around its vertical axis, where a positive angle turns it to the right and a negative angle to the left.
Public methodTeleportLocalAvatar Teleports the local UxrAvatar. The local avatar is the avatar controlled by the user using the headset and input controllers. Non-local avatars are other avatars instantiated in the scene but not controlled by the user, either other users through the network or other scenarios such as automated replays.
Public methodTeleportLocalAvatarAsync

Asynchronous version of TeleportLocalAvatar. Teleports the local UxrAvatar. The local avatar is the avatar controlled by the user using the headset and input controllers. Non-local avatars are other avatars instantiated in the scene but not controlled by the user, either other users through the network or other scenarios such as automated replays.

Public methodTeleportLocalAvatarCoroutine Public teleporting coroutine that can be yielded from an external coroutine. Teleports the local UxrAvatar. The local avatar is the avatar controlled by the user using the headset and input controllers. Non-local avatars are other avatars instantiated in the scene but not controlled by the user, either other users through the network or other scenarios such as automated replays.
Public methodTeleportLocalAvatarRelative Teleports the local UxrAvatar while making sure to keep relative position/orientation on moving objects. Some translationType values have a transition before the teleport to avoid motion sickness. On worlds with moving platforms it is important to specify the destination transform so that:  
  • Relative position/orientation to the destination is preserved.
  • Optionally the local avatar can be parented to the new destination.
  The local avatar is the avatar controlled by the user using the headset and input controllers. Non-local avatars are other avatars instantiated in the scene but not controlled by the user, either other users through the network or other scenarios such as automated replays.
Public methodTeleportLocalAvatarRelativeAsync

Asynchronous version of TeleportLocalAvatar. Teleports the local UxrAvatar. The local avatar is the avatar controlled by the user using the headset and input controllers. Non-local avatars are other avatars instantiated in the scene but not controlled by the user, either other users through the network or other scenarios such as automated replays.

Public methodTeleportLocalAvatarRelativeCoroutine Public teleporting coroutine that can be yielded from an external coroutine. Teleports the local UxrAvatar while making sure to keep relative position/orientation on moving objects. Some translationType values have a transition before the teleport to avoid motion sickness. On worlds with moving platforms it is important to specify the destination transform so that:  
  • Relative position/orientation to the destination is preserved.
  • Optionally the local avatar can be parented to the new destination.
  The local avatar is the avatar controlled by the user using the headset and input controllers. Non-local avatars are other avatars instantiated in the scene but not controlled by the user, either other users through the network or other scenarios such as automated replays.
Public methodTranslateAvatar Translates an avatar.

Events

NameDescription
Public eventStatic memberAvatarMoved Called right after an UxrAvatar was moved.
Public eventStatic memberAvatarMoving Called right before an UxrAvatar is about to be moved.
Public eventStatic memberAvatarsUpdated Called right after processing all update stages in the current frame. Equivalent to StageUpdated for PostProcess
Public eventStatic memberAvatarsUpdating Called right before processing all update stages in the current frame. Equivalent to StageUpdating for Update
Public eventStatic memberPrecachingFinished Called right after precaching finished. It’s called on the first frame that starts to fade-in from black. See UsePrecaching.
Public eventStatic memberPrecachingStarting Called right before precaching is about to start. It’s called on the first frame that is displayed black. See UsePrecaching.
Public eventStatic memberStageUpdated Called right after an update stage in the current frame. See UxrUpdateStage.
Public eventStatic memberStageUpdating Called right before an update stage in the current frame. See UxrUpdateStage.

Fields

NameDescription
Public fieldStatic memberSdkOculus
Public fieldStatic memberSdkPicoXR
Public fieldStatic memberSdkSteamVR
Public fieldStatic memberSdkUltraleap
Public fieldStatic memberSdkUnityInputSystem
Public fieldStatic memberSdkWaveXR
Public fieldStatic memberSdkWindowsMixedReality

Extension Methods

NameDescription
Public Extension MethodCheckSetEnabled Enables/disabled the component if it isn’t enabled already. (Defined by MonoBehaviourExt.)
Public Extension MethodGetOrAddComponent<T> Gets the Component of a given type. If it doesn’t exist, it is added to the GameObject. (Defined by ComponentExt.)
Public Extension MethodGetPathUnderScene Gets the full path under current scene, including all parents, but scene name, for the given component. (Defined by ComponentExt.)
Public Extension MethodGetSceneUid Gets an unique identifier string for the given component. (Defined by ComponentExt.)
Public Extension MethodGetUniqueScenePath Gets an unique path in the scene for the given component. It will include scene name, sibling and component indices to make it unique. (Defined by ComponentExt.)
Public Extension MethodLoopCoroutine Creates a coroutine that simplifies executing a loop during a certain amount of time. (Defined by MonoBehaviourExt.)
Public Extension MethodSafeGetComponentInParent<T> Gets the Component of a given type in the GameObject or any of its parents. It also works on prefabs, where regular GetComponentInParent(Type, Boolean) will not work: https://issuetracker.unity3d.com/issues/getcomponentinparent-is-returning-null-when-the-gameobject-is-a-prefab (Defined by ComponentExt.)
Public Extension MethodShowInInspector(Boolean)Overloaded.
Controls whether to show the current object in the inspector. (Defined by ObjectExt.)
Public Extension MethodShowInInspector(Boolean, Boolean)Overloaded.
Controls whether to show the current object in the inspector and whether it is editable. (Defined by ObjectExt.)
Public Extension MethodThrowIfNull Throws an exception if the object is null. (Defined by ObjectExt.)

See Also

Reference

UltimateXR.Core Namespace