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
Name | Description | |
---|---|---|
UxrManager |
Properties
Name | Description | |
---|---|---|
IsPrecaching | Gets whether the manager is currently pre-caching. This happens right after the local avatar is enabled and UsePrecaching is set. | |
PostUpdateMode | 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. | |
PrecacheFrameCount | 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. | |
TeleportFadeColor | Gets or sets the color used when teleporting using screen fading transitions. | |
UsePrecaching | 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
Name | Description | |
---|---|---|
LogMissingAvatarInHierarchyError | Given a component that requires an UxrAvatar component in the hierarchy in order to work, logs an error indicating that it’s missing. | |
LogMissingAvatarInScene | Given a component that requires an UxrAvatar component in the scene in order to work, logs an error indicating that it’s missing. | |
MoveAvatarTo(UxrAvatar, Single, Boolean) | Moves the avatar to a new floor level. | |
MoveAvatarTo(UxrAvatar, Transform, Boolean) | See MoveAvatarTo. | |
MoveAvatarTo(UxrAvatar, Vector3, Boolean) | Moves an avatar to a new position on the floor, keeping the same viewing direction. The eye level is maintained. | |
MoveAvatarTo(UxrAvatar, Vector3, Vector3, Boolean) | Moves an avatar to a new position on the floor and a viewing direction. The eye level is maintained. | |
RotateAvatar | Rotates the avatar around its vertical axis, where a positive angle turns it to the right and a negative angle to the left. | |
RotateLocalAvatar | 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. | |
RotateLocalAvatarAsync |
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. | |
RotateLocalAvatarCoroutine | 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. | |
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. | |
TeleportLocalAvatarAsync |
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. | |
TeleportLocalAvatarCoroutine | 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. | |
TeleportLocalAvatarRelative |
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:
| |
TeleportLocalAvatarRelativeAsync |
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. | |
TeleportLocalAvatarRelativeCoroutine |
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:
| |
TranslateAvatar | Translates an avatar. |
Events
Name | Description | |
---|---|---|
AvatarMoved | Called right after an UxrAvatar was moved. | |
AvatarMoving | Called right before an UxrAvatar is about to be moved. | |
AvatarsUpdated | Called right after processing all update stages in the current frame. Equivalent to StageUpdated for PostProcess | |
AvatarsUpdating | Called right before processing all update stages in the current frame. Equivalent to StageUpdating for Update | |
PrecachingFinished | Called right after precaching finished. It’s called on the first frame that starts to fade-in from black. See UsePrecaching. | |
PrecachingStarting | Called right before precaching is about to start. It’s called on the first frame that is displayed black. See UsePrecaching. | |
StageUpdated | Called right after an update stage in the current frame. See UxrUpdateStage. | |
StageUpdating | Called right before an update stage in the current frame. See UxrUpdateStage. |
Fields
Name | Description | |
---|---|---|
SdkOculus | ||
SdkPicoXR | ||
SdkSteamVR | ||
SdkUltraleap | ||
SdkUnityInputSystem | ||
SdkWaveXR | ||
SdkWindowsMixedReality |
Extension Methods
Name | Description | |
---|---|---|
CheckSetEnabled | Enables/disabled the component if it isn’t enabled already. (Defined by MonoBehaviourExt.) | |
GetOrAddComponent<T> | Gets the Component of a given type. If it doesn’t exist, it is added to the GameObject. (Defined by ComponentExt.) | |
GetPathUnderScene | Gets the full path under current scene, including all parents, but scene name, for the given component. (Defined by ComponentExt.) | |
GetSceneUid | Gets an unique identifier string for the given component. (Defined by ComponentExt.) | |
GetUniqueScenePath | 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.) | |
LoopCoroutine | Creates a coroutine that simplifies executing a loop during a certain amount of time. (Defined by MonoBehaviourExt.) | |
SafeGetComponentInParent<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.) | |
ShowInInspector(Boolean) | Overloaded. Controls whether to show the current object in the inspector. (Defined by ObjectExt.) | |
ShowInInspector(Boolean, Boolean) | Overloaded. Controls whether to show the current object in the inspector and whether it is editable. (Defined by ObjectExt.) | |
ThrowIfNull | Throws an exception if the object is null. (Defined by ObjectExt.) |