UxrComponent Class

Base class for components in UltimateXR. Has functionality to access the global lists of UltimateXR components, cache Unity components, access initial transform values and some other common utilities. To enumerate all components use the static properties AllComponents and EnabledComponents.

Inheritance Hierarchy

System.Object
  Object
    Component
      Behaviour
        MonoBehaviour
          UltimateXR.Core.Components.UxrComponent
            More… Namespace: UltimateXR.Core.Components
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public abstract class UxrComponent : MonoBehaviour


The UxrComponent type exposes the following members.

Constructors

NameDescription
Protected methodUxrComponent

Properties

NameDescription
Public propertyStatic memberAllComponents Gets all the components, enabled or not, in all open scenes.
Public propertyStatic memberEnabledComponents Gets all components that are enabled, in all open scenes.
Public propertyInitialEulerAngles Gets the eulerAngles value at the moment of Awake()
Public propertyInitialLocalEulerAngles Gets the localEulerAngles value at the moment of Awake()
Public propertyInitialLocalPosition Gets the localPosition value at the moment of Awake()
Public propertyInitialLocalRotation Gets the localRotation value at the moment of Awake()
Public propertyInitialLocalScale Gets the localScale value at the moment of Awake()
Public propertyInitialLocalToWorldMatrix Gets the localToWorldMatrix value at the moment of Awake()
Public propertyInitialLossyScale Gets the lossyScale value at the moment of Awake()
Public propertyInitialParent Gets the parent value at the moment of Awake()
Public propertyInitialPosition Gets the position value at the moment of Awake()
Public propertyInitialRelativeMatrix Gets the transformation matrix relative to the parent transform at the moment of Awake()
Public propertyInitialRotation Gets the rotation value at the moment of Awake()
Public propertyIsApplicationQuitting Gets or sets whether the application is quitting. An application is known to be quitting when OnApplicationQuit() was called.
Public propertyUniqueId Gets the unique Id of the component.

Methods

NameDescription
Protected methodAwake Stores all initial transform values that can be useful for child classes.
Public methodStatic memberDestroyAllComponents Destroys all components.
Public methodStatic memberDestroyAllGameObjects Destroys all gameObjects the components belong to.
Public methodGetCachedComponent<T> Returns a Unity Component cached by type given that there is only one in the GameObject. If there is more than one, it will return the first that GetComponent``1() gets. This method is mainly used to avoid boilerplate code in property getters that return internally cached components.
Protected methodOnApplicationQuit Sets the IsApplicationQuitting value to indicate that the application is quitting.
Protected methodOnDestroy Unity OnDestroy() handling.
Protected methodOnDisable Unity OnDisable() handling.
Protected methodOnEnable Unity OnEnable() handling.
Protected methodOnValidate Unity OnValidate() handling.
Public methodRecomputeInitialTransformData Caches the data of the GameObject’s Transform component. This is called on Awake() but can be called by the user at any point of the program to re-compute the values again using the current state. This can be useful when an object is re-parented and the data using the new parenting is more meaningful.
Protected methodReset Unity Reset() handling.
Protected methodStart Unity Start() handling.
Public methodStatic memberTryGetComponentById Tries to get a component by its unique id.
Public methodTrySetUniqueId Changes the object’s unique Id if it doesn’t exist.

Events

NameDescription
Public eventStatic memberGlobalDisabled Called when a component was disabled.
Public eventStatic memberGlobalEnabled Called when a component was enabled.
Public eventStatic memberGlobalIdChanged Called when a component changed its unique id by using TrySetUniqueId(String). Parameters are oldId, newId.
Public eventStatic memberGlobalIdChanging Called when a component is about to change its unique id by using TrySetUniqueId(String). Parameters are oldId, newId.
Public eventStatic memberGlobalRegistered Called when a component was registered.
Public eventStatic memberGlobalRegistering Called before registering a component.
Public eventStatic memberGlobalUnregistered Called when a component was unregistered.
Public eventStatic memberGlobalUnregistering Called before unregistering a component.

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.)

Remarks

Make sure to override the Unity methods used, and call the base implementation in the body. Components get registered through their Awake() call. This means that components get registered the first time they are enabled. Disabled objects that have been enabled at some point are enumerated, but objects that have never been enabled don’t get enumerated, which means that they will not appear in AllComponents.

See Also

Reference

UltimateXR.Core.Components Namespace

Inheritance HierarchySystem.Object
  Object
    Component
      Behaviour
        MonoBehaviour
          UltimateXR.Core.Components.UxrComponent
            UltimateXR.Animation.Avatars.UxrFaceGestures
            UltimateXR.Animation.Components.UxrToggleComponent
            UltimateXR.Animation.GameObjects.UxrDelayedDestroy
            UltimateXR.Animation.GameObjects.UxrObjectBlink
            UltimateXR.Animation.GameObjects.UxrObjectFade
            UltimateXR.Animation.GameObjects.UxrToggleObject
            UltimateXR.Animation.GameObjects.UxrToggleObjectsUsingButtons
            UltimateXR.Animation.Materials.UxrAnimatedTextureFlipbook
            UltimateXR.Animation.Materials.UxrMaterialRenderQueue
            UltimateXR.Animation.ParticleSystems.UxrToggleEmitParticles
            UltimateXR.Animation.Transforms.UxrAnimatedTransform
            UltimateXR.Animation.Transforms.UxrLookAt
            UltimateXR.Animation.Transforms.UxrLookAtLocalAvatar
            UltimateXR.Animation.Transforms.UxrPositionInFrontOfCamera
            UltimateXR.Animation.UxrAnimatedComponent<T>
            UltimateXR.Audio.UxrAudioBoxVolume
            UltimateXR.Audio.UxrAudioManipulation
            UltimateXR.Audio.UxrAudioSourceStartPos
            UltimateXR.CameraUtils.UxrIgnoreWallFade
            UltimateXR.Core.Components.Singleton.UxrAbstractSingleton<T>
            UltimateXR.Core.Components.UxrComponent<T>
            UltimateXR.Core.Threading.UxrMonoDispatcher
            UltimateXR.Devices.DebugPanels.UxrDebugControllerPanel
            UltimateXR.Devices.DebugPanels.UxrDebugInput1dUI
            UltimateXR.Devices.DebugPanels.UxrDebugInput2dUI
            UltimateXR.Devices.DebugPanels.UxrDebugInputButtonUI
            UltimateXR.Devices.Visualization.UxrController3DModel
            UltimateXR.Guides.UxrCompassTargetHint
            UltimateXR.Haptics.Helpers.UxrFixedHapticFeedback
            UltimateXR.Haptics.Helpers.UxrHapticImpactReceiver
            UltimateXR.Locomotion.UxrIgnoreTeleportDestination
            UltimateXR.Locomotion.UxrParentAvatarDestination
            UltimateXR.Locomotion.UxrTeleportTarget
            UltimateXR.Locomotion.UxrTeleportTargetMaterialID
            UltimateXR.Manipulation.Helpers.UxrAlignOnRelease
            UltimateXR.Manipulation.UxrGrabbableObjectPreviewMesh
            UltimateXR.Manipulation.UxrGrabbableObjectSnapTransform
            UltimateXR.Mechanics.CyborgAvatar.RotateShoulder
            UltimateXR.Mechanics.CyborgAvatar.WristConnectionRays
            UltimateXR.Mechanics.Weapons.UxrExplodeHierarchy
            UltimateXR.Mechanics.Weapons.UxrFirearmAmmoLabel
            UltimateXR.Mechanics.Weapons.UxrFirearmMag
            UltimateXR.Mechanics.Weapons.UxrMuzzleFlash
            UltimateXR.Mechanics.Weapons.UxrOverrideImpactDecal
            UltimateXR.Mechanics.Weapons.UxrShotgunPump
            UltimateXR.Rendering.FX.UxrMagnifyingGlassUrp
            UltimateXR.Rendering.FX.UxrPlanarReflectionBrp
            UltimateXR.Rendering.FX.UxrPlanarReflectionUrp
            UltimateXR.UI.Helpers.HiScores.UxrHiScoresEntry
            UltimateXR.UI.Helpers.HiScores.UxrHiScoresPanelEnterName
            UltimateXR.UI.Helpers.HiScores.UxrHiScoresPanelEntries
            UltimateXR.UI.Helpers.Keyboard.UxrKeyboardKeyUI
            UltimateXR.UI.Helpers.Keyboard.UxrKeyboardUI
            UltimateXR.UI.UnityInputModule.Utils.UxrControlInputDestroyOnPress
            UltimateXR.UI.UnityInputModule.Utils.UxrDynamicPixelsPerUnit
            UltimateXR.UI.UnityInputModule.Utils.UxrHoverTimerClick
            UltimateXR.UI.UnityInputModule.UxrIgnoreCanvas