From ebacd591e81b9609a3126f4d49fb652fa6ba0642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dino=20Fejzagi=C4=87?= Date: Mon, 6 May 2024 20:23:42 +0200 Subject: [PATCH] v1.0.11 (#58) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Prep for release * Auto increment pre-release version to 1.0.1 [skip ci] * disable tagging for development upversion * Apply V2 workflows (#19) Co-authored-by: Simon Jackson * Auto increment pre-release version to 1.0.1-pre-release.1 [skip ci] * Auto increment pre-release version to 1.0.2 [skip ci] * Fix prefab attribute does not render label (#21) * Auto increment pre-release version to 1.0.2-pre.1 [skip ci] * Auto increment pre-release version to 1.0.3 [skip ci] * Updated Rest features (#23) * Updating Rest utilities, added cancellation token to all calls. Plus clean up * Added Unit Tests to Rest functionality * Standardised overload options into a new RestArgs struct * Rationalised implementations for standards * Added overloaded Download function to return a byte[] or file string contents * Fix new script icon * Update workflow to multi-version for test * Updated PostForm following 2022 testing * Include uGUI dependency for the UI extensions in the package * Extract Canvas dependencies from the utility package * Final review and cleanup * Update Readme --------- Co-authored-by: Simon Jackson * Auto increment pre-release version to 1.0.3-pre.1 [skip ci] * Auto increment pre-release version to 1.0.4 [skip ci] * Next release updates (#27) * Initial commit for next round of updates - Changed fixed use of verbs to use the constants from UnityWebRequest definition. - #26 Added additional exception handling to log instead of throw, returns a Failed response instead - #25 Added the ability to set global override parameters - Added the ability to set a preferred download location, either globally or per call. Default is Temp * Auto increment pre-release version to 1.0.4-pre.1 [skip ci] * Add CODEOWNERS * Update for 1.0.4 release (#29) * Auto increment pre-release version to 1.0.4-pre.2 [skip ci] * Address comments * Auto increment pre-release version to 1.0.5 [skip ci] * Added logging utilities for projects (#31) * Added logging utilities for projects * Address review comments * Auto increment pre-release version to 1.0.5-pre.1 [skip ci] * Extended the Unity File helper with an additional option to get all files and not just Unity's own files. (#32) Updated the GuidRegenerator to use all files as it should not be limited when working with a path. * Auto increment pre-release version to 1.0.5-pre.2 [skip ci] * Fix ambiguous call (#34) Co-authored-by: Dino Fejzagic * Auto increment pre-release version to 1.0.5-pre.3 [skip ci] * Added a new Calculate Bounds extension and updated documentation for all (#35) * Auto increment pre-release version to 1.0.5-pre.4 [skip ci] * Update docs and readme for release (#36) * Auto increment pre-release version to 1.0.5-pre.5 [skip ci] * Auto increment pre-release version to 1.0.6 [skip ci] * Added audio streaming (#38) * Added audio streaming --------- Authored-by: Rony Portelli * Auto increment pre-release version to 1.0.7 [skip ci] * Deprecate the Rest utilities as this is not providing value to the toolkit (#42) * Update readme, remove mention of rest * Remove Rest classes and folders * Clean up Rest Tests --------- Co-authored-by: Dino Fejzagić * Auto increment pre-release version to 1.0.7-pre.1 [skip ci] * Auto increment pre-release version to 1.0.8 [skip ci] * Update Editor menus (#45) * Updating Channel packer tool to fit under the asset store version of the Reality Toolkit * Remove Channel package from Utilities * Remove editor preferences static, as each package has its own root * Auto increment pre-release version to 1.0.8-pre.1 [skip ci] * Remove warning and remove redundant type lookup (#46) * Auto increment pre-release version to 1.0.8-pre.2 [skip ci] * Auto increment pre-release version to 1.0.9 [skip ci] * Migrated all Service-Framework only components to the ServiceFramework (#50) * Auto increment pre-release version to 1.0.9-pre.1 [skip ci] * Auto increment pre-release version to 1.0.10 [skip ci] * Fix assembly info pre processor (#53) * Fix assembly info pre processor * Generate assembly infos * Auto increment pre-release version to 1.0.10-pre.1 [skip ci] * Backporting 2020 fix for recent update (#54) * Auto increment pre-release version to 1.0.10-pre.2 [skip ci] * Auto increment pre-release version to 1.0.11 [skip ci] * Feature/ImprovedBoundsExtension (#55) * Migrated new functionality for bounds, needs sanitising * Modified the bounds extension to achieve the correct behaviour --------- Co-authored-by: Rony Portelli * Auto increment pre-release version to 1.0.11-pre.1 [skip ci] * Cleaned up utilities package, removed duplicates between SF and Utilities/Toolkit (#56) * Update package json with missing fields * Clear icons and fix extensions and attributes namespace * Progress * Finish * Auto increment pre-release version to 1.0.11-pre.2 [skip ci] * Migrate @Cangi s work on the MatrixExtensions (#57) Co-authored-by: Dino Fejzagić * Auto increment pre-release version to 1.0.11-pre.3 [skip ci] * Added new TryGet component search methods (#59) * Added new TryGet component search methods * Address feedback * Update readme with latest contents and banner * Auto increment pre-release version to 1.0.11-pre.4 [skip ci] --------- Co-authored-by: Simon (Darkside) Jackson Co-authored-by: realitycollectivebuildbot Co-authored-by: Simon Jackson Co-authored-by: Dino Fejzagic Co-authored-by: Rony Portelli Co-authored-by: Rony Portelli --- .npmignore | 3 - CHANGELOG.md | 4 +- .../com.realitycollective.utilities.md | 76 --- .../AssemblyDefinitionEditorExtension.cs | 4 +- .../AssemblyDefinitionEditorExtension.cs.meta | 2 +- Editor/AssemblyDefinitionPostprocessor.cs | 97 ++++ ...> AssemblyDefinitionPostprocessor.cs.meta} | 4 +- Editor/AssemblyInfo.cs | 2 +- Editor/{Utilities => }/EditorPreferences.cs | 2 +- .../{Utilities => }/EditorPreferences.cs.meta | 2 +- .../EnumFlagsAttributeDrawer.cs | 4 +- .../EnumFlagsAttributeDrawer.cs.meta | 2 +- Editor/Extensions.meta | 8 - .../Extensions/EditorGUILayoutExtensions.cs | 32 -- .../SerializedPropertyExtensions.cs | 57 -- .../SerializedPropertyExtensions.cs.meta | 11 - Editor/{Utilities => }/GuidRegenerator.cs | 2 +- .../{Utilities => }/GuidRegenerator.cs.meta | 2 +- Editor/{Utilities => }/LayerUtilities.cs | 4 +- Editor/{Utilities => }/LayerUtilities.cs.meta | 2 +- .../MinPropertyDrawer.cs | 2 +- .../MinPropertyDrawer.cs.meta | 2 +- .../PhysicsLayerAttributeDrawer.cs | 5 +- .../PhysicsLayerAttributeDrawer.cs.meta | 2 +- .../PrefabPropertyDrawer.cs | 4 +- .../PrefabPropertyDrawer.cs.meta | 2 +- Editor/PropertyDrawers.meta | 8 - .../ScriptableObjectExtensions.cs | 2 +- .../ScriptableObjectExtensions.cs.meta | 2 +- Editor/SystemTypeRepairWindow.cs | 2 +- Editor/SystemTypeRepairWindow.cs.meta | 2 +- Editor/ToolkitPreferences.cs | 38 -- Editor/ToolkitPreferences.cs.meta | 11 - Editor/{Utilities => }/UnityFileHelper.cs | 2 +- .../{Utilities => }/UnityFileHelper.cs.meta | 2 +- Editor/Utilities.meta | 8 - .../Utilities/EditorAssemblyReloadManager.cs | 55 -- .../EditorAssemblyReloadManager.cs.meta | 11 - Editor/Utilities/IconEditor.cs | 111 ---- Editor/Utilities/IconEditor.cs.meta | 11 - Editor/Utilities/USB.meta | 10 - Editor/Utilities/USB/USBDeviceInfo.cs | 30 -- Editor/Utilities/USB/USBDeviceInfo.cs.meta | 11 - Editor/Utilities/USB/USBDeviceListener.cs | 40 -- .../Utilities/USB/USBDeviceListener.cs.meta | 11 - .../Vector3RangePropertyDrawer.cs | 4 +- .../Vector3RangePropertyDrawer.cs.meta | 2 +- README.md | 38 +- Runtime/AssemblyInfo.cs | 2 +- Runtime/{Utilities => }/Async.meta | 0 .../Async/AwaitYieldInstructions.meta | 0 .../BackgroundThread.cs | 0 .../BackgroundThread.cs.meta | 2 +- .../AwaitYieldInstructions/UnityMainThread.cs | 0 .../UnityMainThread.cs.meta | 2 +- .../Async/AwaiterExtensions.cs | 4 +- .../Async/AwaiterExtensions.cs.meta | 2 +- Runtime/{Utilities => }/Async/Awaiters.cs | 0 .../{Utilities => }/Async/Awaiters.cs.meta | 2 +- Runtime/{Utilities => }/Async/Internal.meta | 0 .../Async/Internal/SyncContextUtility.cs | 0 .../Async/Internal/SyncContextUtility.cs.meta | 2 +- Runtime/{Utilities => }/Async/License.md | 0 Runtime/{Utilities => }/Async/License.md.meta | 0 Runtime/{Utilities => }/Async/ReadMe.md | 0 Runtime/{Utilities => }/Async/ReadMe.md.meta | 0 Runtime/Attributes/EnumFlagsAttribute.cs | 2 +- Runtime/Attributes/EnumFlagsAttribute.cs.meta | 1 - .../Attributes/Il2CppSetOptionAttribute.cs | 10 +- .../Il2CppSetOptionAttribute.cs.meta | 1 - Runtime/Attributes/PhysicsLayerAttribute.cs | 2 +- .../Attributes/PhysicsLayerAttribute.cs.meta | 1 - Runtime/Attributes/PrefabAttribute.cs | 2 +- Runtime/Attributes/PrefabAttribute.cs.meta | 1 - Runtime/Attributes/Vector3RangeAttribute.cs | 2 +- .../Attributes/Vector3RangeAttribute.cs.meta | 1 - .../{Utilities => }/CardinalAxis.cs | 2 +- .../{Utilities => }/CardinalAxis.cs.meta | 1 - .../{Utilities => }/ProcessResult.cs | 2 +- .../{Utilities => }/ProcessResult.cs.meta | 1 - Runtime/Definitions/Utilities.meta | 8 - .../Utilities/AnimatorParameter.cs | 97 ---- .../Utilities/AnimatorParameter.cs.meta | 11 - .../Utilities/AutoStartBehavior.cs | 20 - .../Utilities/AutoStartBehavior.cs.meta | 11 - Runtime/Definitions/Utilities/AxisType.cs | 45 -- .../Definitions/Utilities/AxisType.cs.meta | 11 - .../Utilities/CollationOrderType.cs | 32 -- .../Utilities/CollationOrderType.cs.meta | 11 - Runtime/Definitions/Utilities/FlattenMode.cs | 29 - .../Definitions/Utilities/FlattenMode.cs.meta | 11 - Runtime/Definitions/Utilities/Handedness.cs | 42 -- .../Definitions/Utilities/Handedness.cs.meta | 11 - .../Definitions/Utilities/OrientationType.cs | 48 -- .../Utilities/OrientationType.cs.meta | 11 - Runtime/Definitions/Utilities/PivotAxis.cs | 23 - .../Definitions/Utilities/PivotAxis.cs.meta | 11 - .../Utilities/QuaternionSmoothed.cs | 33 -- .../Utilities/QuaternionSmoothed.cs.meta | 11 - .../Utilities/RecognitionConfidenceLevel.cs | 16 - .../RecognitionConfidenceLevel.cs.meta | 11 - .../Definitions/Utilities/RenderPipeline.cs | 29 - .../Utilities/RenderPipeline.cs.meta | 11 - .../Utilities/RotationConstraintType.cs | 13 - .../Utilities/RotationConstraintType.cs.meta | 11 - .../Definitions/Utilities/ScaleStateType.cs | 12 - .../Utilities/ScaleStateType.cs.meta | 11 - .../Definitions/Utilities/Vector3Smoothed.cs | 33 -- .../Utilities/Vector3Smoothed.cs.meta | 11 - .../Extensions/AnimationCurveExtensions.cs | 2 +- .../AnimationCurveExtensions.cs.meta | 1 - Runtime/Extensions/ArrayExtensions.cs | 2 +- Runtime/Extensions/ArrayExtensions.cs.meta | 1 - Runtime/Extensions/AssemblyExtensions.cs | 2 +- Runtime/Extensions/AssemblyExtensions.cs.meta | 1 - Runtime/Extensions/BoundsExtensions.cs | 508 +++++++++++++++++- Runtime/Extensions/BoundsExtensions.cs.meta | 1 - Runtime/Extensions/CameraExtensions.cs | 2 +- Runtime/Extensions/CameraExtensions.cs.meta | 1 - Runtime/Extensions/CollectionsExtensions.cs | 6 +- .../Extensions/CollectionsExtensions.cs.meta | 1 - Runtime/Extensions/ColliderExtensions.cs | 4 +- Runtime/Extensions/ColliderExtensions.cs.meta | 2 - Runtime/Extensions/CollisionExtensions.cs | 4 +- .../Extensions/CollisionExtensions.cs.meta | 2 - Runtime/Extensions/Color32Extensions.cs | 2 +- Runtime/Extensions/Color32Extensions.cs.meta | 1 - Runtime/Extensions/ComparerExtensions.cs | 2 +- Runtime/Extensions/ComparerExtensions.cs.meta | 1 - Runtime/Extensions/ComponentExtensions.cs | 2 +- .../Extensions/ComponentExtensions.cs.meta | 1 - Runtime/Extensions/ConverterExtensions.cs | 2 +- .../Extensions/ConverterExtensions.cs.meta | 1 - Runtime/Extensions/DoubleExtensions.cs | 2 +- Runtime/Extensions/DoubleExtensions.cs.meta | 1 - Runtime/Extensions/EnumExtensions.cs | 2 +- Runtime/Extensions/EnumExtensions.cs.meta | 1 - Runtime/Extensions/EnumerableExtensions.cs | 2 +- .../Extensions/EnumerableExtensions.cs.meta | 1 - Runtime/Extensions/FloatExtensions.cs | 2 +- Runtime/Extensions/FloatExtensions.cs.meta | 1 - Runtime/Extensions/GameObjectExtensions.cs | 81 ++- .../Extensions/GameObjectExtensions.cs.meta | 1 - Runtime/Extensions/HandednessExtensions.cs | 66 --- .../Extensions/HandednessExtensions.cs.meta | 11 - Runtime/Extensions/LayerExtensions.cs | 2 +- Runtime/Extensions/LayerExtensions.cs.meta | 1 - Runtime/Extensions/MathfExtensions.cs | 2 +- Runtime/Extensions/MathfExtensions.cs.meta | 1 - Runtime/Extensions/MatrixExtensions.cs | 40 ++ Runtime/Extensions/MatrixExtensions.cs.meta | 3 + Runtime/Extensions/ProcessExtensions.cs | 4 +- Runtime/Extensions/ProcessExtensions.cs.meta | 1 - Runtime/Extensions/QuaternionExtensions.cs | 2 +- .../Extensions/QuaternionExtensions.cs.meta | 1 - Runtime/Extensions/RayExtensions.cs | 2 +- Runtime/Extensions/RayExtensions.cs.meta | 1 - Runtime/Extensions/SpriteExtensions.cs | 2 +- Runtime/Extensions/SpriteExtensions.cs.meta | 1 - Runtime/Extensions/StringExtensions.cs | 2 +- Runtime/Extensions/StringExtensions.cs.meta | 1 - .../Extensions/SystemNumericsExtensions.cs | 2 +- .../SystemNumericsExtensions.cs.meta | 1 - Runtime/Extensions/TextureExtensions.cs | 4 +- Runtime/Extensions/TextureExtensions.cs.meta | 1 - Runtime/Extensions/TransformExtensions.cs | 2 +- .../Extensions/TransformExtensions.cs.meta | 1 - Runtime/Extensions/UnityObjectExtensions.cs | 2 +- .../Extensions/UnityObjectExtensions.cs.meta | 1 - Runtime/Extensions/VectorExtensions.cs | 2 +- Runtime/Extensions/VectorExtensions.cs.meta | 1 - Runtime/{Utilities.meta => Logging.meta} | 0 .../CaptureApplicationLog.cs | 4 +- .../CaptureApplicationLog.cs.meta | 2 +- .../Utilities => Logging}/FilterLogType.cs | 2 +- .../FilterLogType.cs.meta | 1 - .../{Utilities => Logging}/StaticLogger.cs | 4 +- .../StaticLogger.cs.meta | 2 +- Tests/AssemblyInfo.cs | 2 +- Tests/Extensions/ArrayExtensions.cs | 5 +- Tests/Extensions/ArrayExtensions.cs.meta | 2 +- Tests/Extensions/EnumExtensionTests.cs | 2 +- Tests/Extensions/EnumExtensionTests.cs.meta | 2 +- package.json | 14 +- 184 files changed, 829 insertions(+), 1446 deletions(-) delete mode 100644 .npmignore delete mode 100644 Documentation~/com.realitycollective.utilities.md rename Editor/{Utilities => }/AssemblyDefinitionEditorExtension.cs (99%) rename Editor/{Utilities => }/AssemblyDefinitionEditorExtension.cs.meta (74%) create mode 100644 Editor/AssemblyDefinitionPostprocessor.cs rename Editor/{Extensions/EditorGUILayoutExtensions.cs.meta => AssemblyDefinitionPostprocessor.cs.meta} (61%) rename Editor/{Utilities => }/EditorPreferences.cs (99%) rename Editor/{Utilities => }/EditorPreferences.cs.meta (74%) rename Editor/{PropertyDrawers => }/EnumFlagsAttributeDrawer.cs (89%) rename Editor/{PropertyDrawers => }/EnumFlagsAttributeDrawer.cs.meta (74%) delete mode 100644 Editor/Extensions.meta delete mode 100644 Editor/Extensions/EditorGUILayoutExtensions.cs delete mode 100644 Editor/Extensions/SerializedPropertyExtensions.cs delete mode 100644 Editor/Extensions/SerializedPropertyExtensions.cs.meta rename Editor/{Utilities => }/GuidRegenerator.cs (99%) rename Editor/{Utilities => }/GuidRegenerator.cs.meta (74%) rename Editor/{Utilities => }/LayerUtilities.cs (98%) rename Editor/{Utilities => }/LayerUtilities.cs.meta (74%) rename Editor/{PropertyDrawers => }/MinPropertyDrawer.cs (97%) rename Editor/{PropertyDrawers => }/MinPropertyDrawer.cs.meta (74%) rename Editor/{PropertyDrawers => }/PhysicsLayerAttributeDrawer.cs (91%) rename Editor/{PropertyDrawers => }/PhysicsLayerAttributeDrawer.cs.meta (74%) rename Editor/{PropertyDrawers => }/PrefabPropertyDrawer.cs (96%) rename Editor/{PropertyDrawers => }/PrefabPropertyDrawer.cs.meta (74%) delete mode 100644 Editor/PropertyDrawers.meta rename Editor/{Extensions => }/ScriptableObjectExtensions.cs (99%) rename Editor/{Extensions => }/ScriptableObjectExtensions.cs.meta (74%) delete mode 100644 Editor/ToolkitPreferences.cs delete mode 100644 Editor/ToolkitPreferences.cs.meta rename Editor/{Utilities => }/UnityFileHelper.cs (98%) rename Editor/{Utilities => }/UnityFileHelper.cs.meta (74%) delete mode 100644 Editor/Utilities.meta delete mode 100644 Editor/Utilities/EditorAssemblyReloadManager.cs delete mode 100644 Editor/Utilities/EditorAssemblyReloadManager.cs.meta delete mode 100644 Editor/Utilities/IconEditor.cs delete mode 100644 Editor/Utilities/IconEditor.cs.meta delete mode 100644 Editor/Utilities/USB.meta delete mode 100644 Editor/Utilities/USB/USBDeviceInfo.cs delete mode 100644 Editor/Utilities/USB/USBDeviceInfo.cs.meta delete mode 100644 Editor/Utilities/USB/USBDeviceListener.cs delete mode 100644 Editor/Utilities/USB/USBDeviceListener.cs.meta rename Editor/{PropertyDrawers => }/Vector3RangePropertyDrawer.cs (95%) rename Editor/{PropertyDrawers => }/Vector3RangePropertyDrawer.cs.meta (74%) rename Runtime/{Utilities => }/Async.meta (100%) rename Runtime/{Utilities => }/Async/AwaitYieldInstructions.meta (100%) rename Runtime/{Utilities => }/Async/AwaitYieldInstructions/BackgroundThread.cs (100%) rename Runtime/{Utilities => }/Async/AwaitYieldInstructions/BackgroundThread.cs.meta (74%) rename Runtime/{Utilities => }/Async/AwaitYieldInstructions/UnityMainThread.cs (100%) rename Runtime/{Utilities => }/Async/AwaitYieldInstructions/UnityMainThread.cs.meta (74%) rename Runtime/{Utilities => }/Async/AwaiterExtensions.cs (99%) rename Runtime/{Utilities => }/Async/AwaiterExtensions.cs.meta (74%) rename Runtime/{Utilities => }/Async/Awaiters.cs (100%) rename Runtime/{Utilities => }/Async/Awaiters.cs.meta (74%) rename Runtime/{Utilities => }/Async/Internal.meta (100%) rename Runtime/{Utilities => }/Async/Internal/SyncContextUtility.cs (100%) rename Runtime/{Utilities => }/Async/Internal/SyncContextUtility.cs.meta (74%) rename Runtime/{Utilities => }/Async/License.md (100%) rename Runtime/{Utilities => }/Async/License.md.meta (100%) rename Runtime/{Utilities => }/Async/ReadMe.md (100%) rename Runtime/{Utilities => }/Async/ReadMe.md.meta (100%) rename Runtime/Definitions/{Utilities => }/CardinalAxis.cs (91%) rename Runtime/Definitions/{Utilities => }/CardinalAxis.cs.meta (74%) rename Runtime/Definitions/{Utilities => }/ProcessResult.cs (95%) rename Runtime/Definitions/{Utilities => }/ProcessResult.cs.meta (74%) delete mode 100644 Runtime/Definitions/Utilities.meta delete mode 100644 Runtime/Definitions/Utilities/AnimatorParameter.cs delete mode 100644 Runtime/Definitions/Utilities/AnimatorParameter.cs.meta delete mode 100644 Runtime/Definitions/Utilities/AutoStartBehavior.cs delete mode 100644 Runtime/Definitions/Utilities/AutoStartBehavior.cs.meta delete mode 100644 Runtime/Definitions/Utilities/AxisType.cs delete mode 100644 Runtime/Definitions/Utilities/AxisType.cs.meta delete mode 100644 Runtime/Definitions/Utilities/CollationOrderType.cs delete mode 100644 Runtime/Definitions/Utilities/CollationOrderType.cs.meta delete mode 100644 Runtime/Definitions/Utilities/FlattenMode.cs delete mode 100644 Runtime/Definitions/Utilities/FlattenMode.cs.meta delete mode 100644 Runtime/Definitions/Utilities/Handedness.cs delete mode 100644 Runtime/Definitions/Utilities/Handedness.cs.meta delete mode 100644 Runtime/Definitions/Utilities/OrientationType.cs delete mode 100644 Runtime/Definitions/Utilities/OrientationType.cs.meta delete mode 100644 Runtime/Definitions/Utilities/PivotAxis.cs delete mode 100644 Runtime/Definitions/Utilities/PivotAxis.cs.meta delete mode 100644 Runtime/Definitions/Utilities/QuaternionSmoothed.cs delete mode 100644 Runtime/Definitions/Utilities/QuaternionSmoothed.cs.meta delete mode 100644 Runtime/Definitions/Utilities/RecognitionConfidenceLevel.cs delete mode 100644 Runtime/Definitions/Utilities/RecognitionConfidenceLevel.cs.meta delete mode 100644 Runtime/Definitions/Utilities/RenderPipeline.cs delete mode 100644 Runtime/Definitions/Utilities/RenderPipeline.cs.meta delete mode 100644 Runtime/Definitions/Utilities/RotationConstraintType.cs delete mode 100644 Runtime/Definitions/Utilities/RotationConstraintType.cs.meta delete mode 100644 Runtime/Definitions/Utilities/ScaleStateType.cs delete mode 100644 Runtime/Definitions/Utilities/ScaleStateType.cs.meta delete mode 100644 Runtime/Definitions/Utilities/Vector3Smoothed.cs delete mode 100644 Runtime/Definitions/Utilities/Vector3Smoothed.cs.meta delete mode 100644 Runtime/Extensions/HandednessExtensions.cs delete mode 100644 Runtime/Extensions/HandednessExtensions.cs.meta create mode 100644 Runtime/Extensions/MatrixExtensions.cs create mode 100644 Runtime/Extensions/MatrixExtensions.cs.meta rename Runtime/{Utilities.meta => Logging.meta} (100%) rename Runtime/{Utilities => Logging}/CaptureApplicationLog.cs (90%) rename Runtime/{Utilities => Logging}/CaptureApplicationLog.cs.meta (74%) rename Runtime/{Definitions/Utilities => Logging}/FilterLogType.cs (94%) rename Runtime/{Definitions/Utilities => Logging}/FilterLogType.cs.meta (74%) rename Runtime/{Utilities => Logging}/StaticLogger.cs (97%) rename Runtime/{Utilities => Logging}/StaticLogger.cs.meta (74%) diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 7f1a1c7..0000000 --- a/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -.github/ -Tests/ -Tests.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bdfbc4..fb15de0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,3 @@ -Placeholder to be replaced by root [changelog](../../../CHANGELOG.md) during build +# Changelog + +Please refer to the package's [Releases GitHub Page](https://github.com/realitycollective/com.realitytoolkit.utilities/releases) for the changelog. \ No newline at end of file diff --git a/Documentation~/com.realitycollective.utilities.md b/Documentation~/com.realitycollective.utilities.md deleted file mode 100644 index cdb26e9..0000000 --- a/Documentation~/com.realitycollective.utilities.md +++ /dev/null @@ -1,76 +0,0 @@ - - -## What's included? - -A collection of useful utilities for Unity Projects by the Reality Collective. Useful for any Unity Project to accelerate and code safely within Unity. - -### Utilities - -* Rest - A collection of Rest based tools to make making and using Rest calls in Unity very easy. -* Async - A collection of Asynchronous and CoRoutine helpers for working with Sync -> Async code. - -### Extensions - -* AnimationCurveExtensions -* ArrayExtensions -* AssemblyExtensions -* BoundsExtensions -* CameraExtensions -* CollectionsExtensions -* ColliderExtensions -* CollisionExtensions -* Color32Extensions -* ComparerExtensions -* ComponentExtensions -* ConverterExtensions -* DoubleExtensions -* EnumerableExtensions -* EnumExtensions -* FloatExtensions -* GameObjectExtensions -* HandednessExtensions -* LayerExtensions -* MathfExtensions -* ProcessExtensions -* QuaternionExtensions -* RayExtensions -* SpriteExtensions -* StringExtensions -* SystemNumericsExtensions -* TextureExtensions -* TransformExtensions -* TypeExtensions -* UnityObjectExtensions -* VectorExtensions - -### Reusable definitions - -* AnimatorParameter -* AutoStartBehavior -* AxisType -* CardinalAxis -* CollationOrderType -* FlattenMode -* Handedness -* OrientationType -* PivotAxis -* ProcessResult -* QuaternionSmoothed -* RecognitionConfidenceLevel -* RenderPipeline -* RotationConstraintType -* ScaleStateType -* SystemType -* TypeGrouping -* Vector3Smoothed - -### Property Attributes - -* EnumFlagsAttribute -* ExtendsAttribute -* Il2CppSetOptionAttribute -* ImplementsAttribute -* PhysicsLayerAttribute -* PrefabAttribute -* SystemTypeAttribute -* Vector3RangeAttribute \ No newline at end of file diff --git a/Editor/Utilities/AssemblyDefinitionEditorExtension.cs b/Editor/AssemblyDefinitionEditorExtension.cs similarity index 99% rename from Editor/Utilities/AssemblyDefinitionEditorExtension.cs rename to Editor/AssemblyDefinitionEditorExtension.cs index 01bbccd..ef7c6b2 100644 --- a/Editor/Utilities/AssemblyDefinitionEditorExtension.cs +++ b/Editor/AssemblyDefinitionEditorExtension.cs @@ -1,6 +1,7 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using RealityCollective.Utilities.Extensions; using System; using System.IO; using System.Linq; @@ -8,9 +9,8 @@ using UnityEditor.Compilation; using UnityEditorInternal; using UnityEngine; -using RealityCollective.Extensions; -namespace RealityCollective.Editor.Utilities +namespace RealityCollective.Utilities.Editor { public static class AssemblyDefinitionEditorExtension { diff --git a/Editor/Utilities/AssemblyDefinitionEditorExtension.cs.meta b/Editor/AssemblyDefinitionEditorExtension.cs.meta similarity index 74% rename from Editor/Utilities/AssemblyDefinitionEditorExtension.cs.meta rename to Editor/AssemblyDefinitionEditorExtension.cs.meta index eaa1c84..20f1e4c 100644 --- a/Editor/Utilities/AssemblyDefinitionEditorExtension.cs.meta +++ b/Editor/AssemblyDefinitionEditorExtension.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/AssemblyDefinitionPostprocessor.cs b/Editor/AssemblyDefinitionPostprocessor.cs new file mode 100644 index 0000000..1c6cce0 --- /dev/null +++ b/Editor/AssemblyDefinitionPostprocessor.cs @@ -0,0 +1,97 @@ +// Copyright (c) Reality Collective. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; +using System.IO; +using System.Text.RegularExpressions; +using UnityEditor; +using UnityEngine; + +namespace RealityCollective.Utilities.Editor +{ + internal class AssemblyDefinitionPostprocessor : AssetPostprocessor + { + [Serializable] + private class PackageInfo + { + [SerializeField] + private string name; + + public string Name => name; + + [SerializeField] + private string version; + + public string Version => version; + } + + private const string VersionRegexPattern = "\\[assembly: AssemblyVersion\\(\"(.*)\"\\)\\]"; + + private void OnPreprocessAsset() + { + if (assetPath.Contains("package.json") && !Application.isBatchMode) + { + if (Path.GetFullPath(assetPath).Contains("PackageCache")) + { + return; + } + + var text = File.ReadAllText(assetPath); + var packageJson = JsonUtility.FromJson(text); + + if (!packageJson.Name.Contains("com.realitycollective") && + !packageJson.Name.Contains("com.realitytoolkit")) + { + return; + } + + var packageVersion = packageJson.Version; + + if (packageVersion.Contains("-pre.")) + { +#if UNITY_2021_1_OR_NEWER + packageVersion = packageVersion[..packageVersion.IndexOf("-", StringComparison.Ordinal)]; +#else + packageVersion = packageVersion.Substring(0, packageVersion.IndexOf("-", StringComparison.Ordinal)); +#endif + } + + var newVersion = $"[assembly: AssemblyVersion(\"{packageVersion}\")]"; + var asmdefs = Directory.GetFiles(assetPath.Replace("package.json", string.Empty), "*.asmdef", SearchOption.AllDirectories); + + foreach (var assembly in asmdefs) + { + var assemblyName = Path.GetFileNameWithoutExtension(assembly).ToLower(); + var directory = Path.GetDirectoryName(assembly); + var assemblyInfoPath = $"{directory}/AssemblyInfo.cs"; + var fileText = !File.Exists(assemblyInfoPath) + ? $@"// Copyright (c) Reality Collective. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System.Reflection; + +[assembly: AssemblyVersion(""0.0.0"")] +[assembly: AssemblyTitle(""com.{assemblyName}"")] +[assembly: AssemblyCompany(""Reality Collective"")] +[assembly: AssemblyCopyright(""Copyright (c) Reality Collective. All rights reserved."")] +" + : File.ReadAllText(assemblyInfoPath); + + if (!fileText.Contains("AssemblyVersion")) + { + fileText += "\nusing System.Reflection;\n\n[assembly: AssemblyVersion(\"0.0.0\")]\n"; + } + + if (!fileText.Contains("AssemblyTitle")) + { + fileText += $"[assembly: AssemblyTitle(\"com.{assemblyName}\")]\n"; + } + + File.WriteAllText(assemblyInfoPath, Regex.Replace(fileText, VersionRegexPattern, newVersion)); + } + + AssetDatabase.Refresh(ImportAssetOptions.Default); + } + } + } +} diff --git a/Editor/Extensions/EditorGUILayoutExtensions.cs.meta b/Editor/AssemblyDefinitionPostprocessor.cs.meta similarity index 61% rename from Editor/Extensions/EditorGUILayoutExtensions.cs.meta rename to Editor/AssemblyDefinitionPostprocessor.cs.meta index e5dbe44..05593bf 100644 --- a/Editor/Extensions/EditorGUILayoutExtensions.cs.meta +++ b/Editor/AssemblyDefinitionPostprocessor.cs.meta @@ -1,11 +1,11 @@ fileFormatVersion: 2 -guid: 47093934dde4fa7458039b452d7b9d37 +guid: ae88737d43244bc3928db0d855c2d44a MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/AssemblyInfo.cs b/Editor/AssemblyInfo.cs index cee60dd..3720f1c 100644 --- a/Editor/AssemblyInfo.cs +++ b/Editor/AssemblyInfo.cs @@ -3,7 +3,7 @@ using System.Reflection; -[assembly: AssemblyVersion("1.0.10")] +[assembly: AssemblyVersion("1.0.11")] [assembly: AssemblyTitle("com.realitycollective.utilities.editor")] [assembly: AssemblyCompany("Reality Collective")] [assembly: AssemblyCopyright("Copyright (c) Reality Collective. All rights reserved.")] diff --git a/Editor/Utilities/EditorPreferences.cs b/Editor/EditorPreferences.cs similarity index 99% rename from Editor/Utilities/EditorPreferences.cs rename to Editor/EditorPreferences.cs index 259f9d6..859928e 100644 --- a/Editor/Utilities/EditorPreferences.cs +++ b/Editor/EditorPreferences.cs @@ -4,7 +4,7 @@ using UnityEditor; using UnityEngine; -namespace RealityCollective.Editor.Utilities +namespace RealityCollective.Utilities.Editor { /// /// Convenience class for setting Editor Preferences with as key prefix. diff --git a/Editor/Utilities/EditorPreferences.cs.meta b/Editor/EditorPreferences.cs.meta similarity index 74% rename from Editor/Utilities/EditorPreferences.cs.meta rename to Editor/EditorPreferences.cs.meta index 7236d7b..e359b00 100644 --- a/Editor/Utilities/EditorPreferences.cs.meta +++ b/Editor/EditorPreferences.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/PropertyDrawers/EnumFlagsAttributeDrawer.cs b/Editor/EnumFlagsAttributeDrawer.cs similarity index 89% rename from Editor/PropertyDrawers/EnumFlagsAttributeDrawer.cs rename to Editor/EnumFlagsAttributeDrawer.cs index ce99830..5c552e4 100644 --- a/Editor/PropertyDrawers/EnumFlagsAttributeDrawer.cs +++ b/Editor/EnumFlagsAttributeDrawer.cs @@ -1,11 +1,11 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using RealityCollective.Attributes; +using RealityCollective.Utilities.Attributes; using UnityEditor; using UnityEngine; -namespace RealityCollective.Editor.PropertyDrawers +namespace RealityCollective.Utilities.Editor { /// /// Renders enum flags on fields with the attribute. diff --git a/Editor/PropertyDrawers/EnumFlagsAttributeDrawer.cs.meta b/Editor/EnumFlagsAttributeDrawer.cs.meta similarity index 74% rename from Editor/PropertyDrawers/EnumFlagsAttributeDrawer.cs.meta rename to Editor/EnumFlagsAttributeDrawer.cs.meta index a333114..848cfbf 100644 --- a/Editor/PropertyDrawers/EnumFlagsAttributeDrawer.cs.meta +++ b/Editor/EnumFlagsAttributeDrawer.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/Extensions.meta b/Editor/Extensions.meta deleted file mode 100644 index 995d567..0000000 --- a/Editor/Extensions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d320680c3671ce64d82ddba4e24faf5d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Extensions/EditorGUILayoutExtensions.cs b/Editor/Extensions/EditorGUILayoutExtensions.cs deleted file mode 100644 index 7fbb59e..0000000 --- a/Editor/Extensions/EditorGUILayoutExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using UnityEditor; -using UnityEngine; - -namespace RealityCollective.Editor.Extensions -{ - /// - /// Extensions for usage. - /// - public static class EditorGUILayoutExtensions - { - /// - /// Draws a foldout but with bold label text. - /// - /// Foldout state. - /// Foldout label content. - /// Should the foldout toggle on label click? - /// Returns true, if foldout unfolded. - public static bool FoldoutWithBoldLabel(bool foldout, GUIContent content, bool toggleOnLabelClick = true) - { - GUIStyle defaultStyle = EditorStyles.foldout; - FontStyle previousStyle = defaultStyle.fontStyle; - defaultStyle.fontStyle = FontStyle.Bold; - foldout = EditorGUILayout.Foldout(foldout, content, toggleOnLabelClick); - defaultStyle.fontStyle = previousStyle; - - return foldout; - } - } -} \ No newline at end of file diff --git a/Editor/Extensions/SerializedPropertyExtensions.cs b/Editor/Extensions/SerializedPropertyExtensions.cs deleted file mode 100644 index 15eca8f..0000000 --- a/Editor/Extensions/SerializedPropertyExtensions.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using UnityEditor; -using UnityEngine; - -namespace RealityCollective.Editor.Extensions -{ - /// - /// Extensions for usage. - /// - public static class SerializedPropertyExtensions - { - - /// - /// Draws a foldout but with bold label text. - /// - /// to check if expanded. - /// Foldout label content. - /// Should the property field render its children? - /// Optional options. - /// label content. - /// Returns true, if foldout unfolded. - public static bool FoldoutWithBoldLabelPropertyField(this SerializedProperty property, GUIContent foldoutContent, GUIContent propertyContent, bool showPropertyChildren = true, params GUILayoutOption[] layoutOptions) - { - return property.FoldoutWithBoldLabelPropertyField(foldoutContent, true, propertyContent, showPropertyChildren, layoutOptions); - } - - /// - /// Draws a foldout but with bold label text. - /// - /// to check if expanded. - /// Foldout label content. - /// Should the foldout toggle on label click? - /// Should the property field render its children? - /// Optional options. - /// label content. - /// Returns true, if foldout unfolded. - public static bool FoldoutWithBoldLabelPropertyField(this SerializedProperty property, GUIContent foldoutContent, bool toggleOnLabelClick = true, GUIContent propertyContent = null, bool showPropertyChildren = true, params GUILayoutOption[] layoutOptions) - { - var defaultStyle = EditorStyles.foldout; - var previousStyle = defaultStyle.fontStyle; - defaultStyle.fontStyle = FontStyle.Bold; - property.isExpanded = EditorGUILayout.Foldout(property.isExpanded, foldoutContent, toggleOnLabelClick); - defaultStyle.fontStyle = previousStyle; - - if (property.isExpanded) - { - EditorGUI.indentLevel++; - EditorGUILayout.PropertyField(property, propertyContent, showPropertyChildren, layoutOptions); - EditorGUI.indentLevel--; - } - - return property.isExpanded; - } - } -} \ No newline at end of file diff --git a/Editor/Extensions/SerializedPropertyExtensions.cs.meta b/Editor/Extensions/SerializedPropertyExtensions.cs.meta deleted file mode 100644 index 32d7688..0000000 --- a/Editor/Extensions/SerializedPropertyExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 60715e6930ac4f89993057348cb6d06d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Utilities/GuidRegenerator.cs b/Editor/GuidRegenerator.cs similarity index 99% rename from Editor/Utilities/GuidRegenerator.cs rename to Editor/GuidRegenerator.cs index 10fed73..782d97f 100644 --- a/Editor/Utilities/GuidRegenerator.cs +++ b/Editor/GuidRegenerator.cs @@ -8,7 +8,7 @@ using UnityEditor; using UnityEngine; -namespace RealityCollective.Editor.Utilities +namespace RealityCollective.Utilities.Editor { /// /// diff --git a/Editor/Utilities/GuidRegenerator.cs.meta b/Editor/GuidRegenerator.cs.meta similarity index 74% rename from Editor/Utilities/GuidRegenerator.cs.meta rename to Editor/GuidRegenerator.cs.meta index afc1b85..034bb1d 100644 --- a/Editor/Utilities/GuidRegenerator.cs.meta +++ b/Editor/GuidRegenerator.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/Utilities/LayerUtilities.cs b/Editor/LayerUtilities.cs similarity index 98% rename from Editor/Utilities/LayerUtilities.cs rename to Editor/LayerUtilities.cs index 0bb5a29..90a17d1 100644 --- a/Editor/Utilities/LayerUtilities.cs +++ b/Editor/LayerUtilities.cs @@ -1,11 +1,11 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using RealityCollective.Utilities.Extensions; using System; -using RealityCollective.Extensions; using UnityEngine; -namespace RealityCollective.Editor.Utilities +namespace RealityCollective.Utilities.Editor { public static class LayerUtilities { diff --git a/Editor/Utilities/LayerUtilities.cs.meta b/Editor/LayerUtilities.cs.meta similarity index 74% rename from Editor/Utilities/LayerUtilities.cs.meta rename to Editor/LayerUtilities.cs.meta index 4d76d5f..659fb80 100644 --- a/Editor/Utilities/LayerUtilities.cs.meta +++ b/Editor/LayerUtilities.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/PropertyDrawers/MinPropertyDrawer.cs b/Editor/MinPropertyDrawer.cs similarity index 97% rename from Editor/PropertyDrawers/MinPropertyDrawer.cs rename to Editor/MinPropertyDrawer.cs index 5a1be75..d933d65 100644 --- a/Editor/PropertyDrawers/MinPropertyDrawer.cs +++ b/Editor/MinPropertyDrawer.cs @@ -4,7 +4,7 @@ using UnityEditor; using UnityEngine; -namespace RealityCollective.Editor.PropertyDrawers +namespace RealityCollective.Utilities.Editor { /// /// Custom property drawer for decorated or values rendered in the inspector. diff --git a/Editor/PropertyDrawers/MinPropertyDrawer.cs.meta b/Editor/MinPropertyDrawer.cs.meta similarity index 74% rename from Editor/PropertyDrawers/MinPropertyDrawer.cs.meta rename to Editor/MinPropertyDrawer.cs.meta index f9e16f1..4018210 100644 --- a/Editor/PropertyDrawers/MinPropertyDrawer.cs.meta +++ b/Editor/MinPropertyDrawer.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/PropertyDrawers/PhysicsLayerAttributeDrawer.cs b/Editor/PhysicsLayerAttributeDrawer.cs similarity index 91% rename from Editor/PropertyDrawers/PhysicsLayerAttributeDrawer.cs rename to Editor/PhysicsLayerAttributeDrawer.cs index 9b0294c..3d86477 100644 --- a/Editor/PropertyDrawers/PhysicsLayerAttributeDrawer.cs +++ b/Editor/PhysicsLayerAttributeDrawer.cs @@ -1,13 +1,12 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using RealityCollective.Utilities.Attributes; using System.Collections.Generic; -using RealityCollective.Attributes; -using RealityCollective.Editor.Utilities; using UnityEditor; using UnityEngine; -namespace RealityCollective.Editor.PropertyDrawers +namespace RealityCollective.Utilities.Editor { /// /// Renders the physics layer dropdown based on the current layers set in the Tag Manager. diff --git a/Editor/PropertyDrawers/PhysicsLayerAttributeDrawer.cs.meta b/Editor/PhysicsLayerAttributeDrawer.cs.meta similarity index 74% rename from Editor/PropertyDrawers/PhysicsLayerAttributeDrawer.cs.meta rename to Editor/PhysicsLayerAttributeDrawer.cs.meta index c620bdd..97bb0da 100644 --- a/Editor/PropertyDrawers/PhysicsLayerAttributeDrawer.cs.meta +++ b/Editor/PhysicsLayerAttributeDrawer.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/PropertyDrawers/PrefabPropertyDrawer.cs b/Editor/PrefabPropertyDrawer.cs similarity index 96% rename from Editor/PropertyDrawers/PrefabPropertyDrawer.cs rename to Editor/PrefabPropertyDrawer.cs index 0033ff7..60cd0c2 100644 --- a/Editor/PropertyDrawers/PrefabPropertyDrawer.cs +++ b/Editor/PrefabPropertyDrawer.cs @@ -1,11 +1,11 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using RealityCollective.Attributes; +using RealityCollective.Utilities.Attributes; using UnityEditor; using UnityEngine; -namespace RealityCollective.Editor.PropertyDrawers +namespace RealityCollective.Utilities.Editor { /// /// Custom property drawer for decorated values rendered in the inspector. diff --git a/Editor/PropertyDrawers/PrefabPropertyDrawer.cs.meta b/Editor/PrefabPropertyDrawer.cs.meta similarity index 74% rename from Editor/PropertyDrawers/PrefabPropertyDrawer.cs.meta rename to Editor/PrefabPropertyDrawer.cs.meta index 6c720a7..8a5c9c5 100644 --- a/Editor/PropertyDrawers/PrefabPropertyDrawer.cs.meta +++ b/Editor/PrefabPropertyDrawer.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/PropertyDrawers.meta b/Editor/PropertyDrawers.meta deleted file mode 100644 index 0bd3a9d..0000000 --- a/Editor/PropertyDrawers.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 88c4c9d8e285e3543bf349397aea7abf -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Extensions/ScriptableObjectExtensions.cs b/Editor/ScriptableObjectExtensions.cs similarity index 99% rename from Editor/Extensions/ScriptableObjectExtensions.cs rename to Editor/ScriptableObjectExtensions.cs index ae31676..5737ff8 100644 --- a/Editor/Extensions/ScriptableObjectExtensions.cs +++ b/Editor/ScriptableObjectExtensions.cs @@ -6,7 +6,7 @@ using UnityEditor; using UnityEngine; -namespace RealityCollective.Editor.Extensions +namespace RealityCollective.Utilities.Editor { /// /// Extensions for s diff --git a/Editor/Extensions/ScriptableObjectExtensions.cs.meta b/Editor/ScriptableObjectExtensions.cs.meta similarity index 74% rename from Editor/Extensions/ScriptableObjectExtensions.cs.meta rename to Editor/ScriptableObjectExtensions.cs.meta index da9432f..7b53b39 100644 --- a/Editor/Extensions/ScriptableObjectExtensions.cs.meta +++ b/Editor/ScriptableObjectExtensions.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/SystemTypeRepairWindow.cs b/Editor/SystemTypeRepairWindow.cs index 5ae5563..6d60918 100644 --- a/Editor/SystemTypeRepairWindow.cs +++ b/Editor/SystemTypeRepairWindow.cs @@ -5,7 +5,7 @@ using UnityEditor; using UnityEngine; -namespace RealityCollective.Editor +namespace RealityCollective.Utilities.Editor { /// /// Popup window to help facilitate fixing broken serialized references. diff --git a/Editor/SystemTypeRepairWindow.cs.meta b/Editor/SystemTypeRepairWindow.cs.meta index ae57c17..fb91b32 100644 --- a/Editor/SystemTypeRepairWindow.cs.meta +++ b/Editor/SystemTypeRepairWindow.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/ToolkitPreferences.cs b/Editor/ToolkitPreferences.cs deleted file mode 100644 index 58c3638..0000000 --- a/Editor/ToolkitPreferences.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using RealityCollective.Editor.Utilities; -using UnityEngine; - -namespace RealityCollective.Utilities.Editor -{ - public static class ToolkitPreferences - { - #region Debug Symbolic Links - - //private static readonly GUIContent DebugSymbolicContent = new GUIContent("Debug symbolic linking", "Enable or disable the debug information for symbolic linking.\n\nThis setting only applies to the currently running project."); - private const string SYMBOLIC_DEBUG_KEY = "EnablePackageDebug"; - private static bool isSymbolicDebugPrefLoaded; - private static bool debugSymbolicInfo; - - /// - /// Enabled debugging info for the symbolic linking. - /// - public static bool DebugSymbolicInfo - { - get - { - if (!isSymbolicDebugPrefLoaded) - { - debugSymbolicInfo = EditorPreferences.Get(SYMBOLIC_DEBUG_KEY, Application.isBatchMode); - isSymbolicDebugPrefLoaded = true; - } - - return debugSymbolicInfo; - } - set => EditorPreferences.Set(SYMBOLIC_DEBUG_KEY, debugSymbolicInfo = value); - } - - #endregion Debug Symbolic Links - } -} \ No newline at end of file diff --git a/Editor/ToolkitPreferences.cs.meta b/Editor/ToolkitPreferences.cs.meta deleted file mode 100644 index f09b737..0000000 --- a/Editor/ToolkitPreferences.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4a9885e393a71d249ae1d344cc88c050 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Utilities/UnityFileHelper.cs b/Editor/UnityFileHelper.cs similarity index 98% rename from Editor/Utilities/UnityFileHelper.cs rename to Editor/UnityFileHelper.cs index a825de0..535df62 100644 --- a/Editor/Utilities/UnityFileHelper.cs +++ b/Editor/UnityFileHelper.cs @@ -6,7 +6,7 @@ using System.IO; using UnityEngine; -namespace RealityCollective.Editor.Utilities +namespace RealityCollective.Utilities.Editor { public static class UnityFileHelper { diff --git a/Editor/Utilities/UnityFileHelper.cs.meta b/Editor/UnityFileHelper.cs.meta similarity index 74% rename from Editor/Utilities/UnityFileHelper.cs.meta rename to Editor/UnityFileHelper.cs.meta index c55030e..568422b 100644 --- a/Editor/Utilities/UnityFileHelper.cs.meta +++ b/Editor/UnityFileHelper.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Editor/Utilities.meta b/Editor/Utilities.meta deleted file mode 100644 index 341c228..0000000 --- a/Editor/Utilities.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 68917077c74b464faf38902f5216f221 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Utilities/EditorAssemblyReloadManager.cs b/Editor/Utilities/EditorAssemblyReloadManager.cs deleted file mode 100644 index 74aab0d..0000000 --- a/Editor/Utilities/EditorAssemblyReloadManager.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using UnityEditor; -using UnityEngine; - -namespace RealityCollective.Editor.Utilities -{ - public static class EditorAssemblyReloadManager - { - private static bool locked = false; - - /// - /// Locks the Editor's ability to reload assemblies. - /// - /// - /// This is useful for ensuring async tasks complete in the editor without having to worry if any script - /// changes that happen during the running task will cancel it when the editor re-compiles the assemblies. - /// - public static bool LockReloadAssemblies - { - set - { - locked = value; - - if (locked) - { - EditorApplication.LockReloadAssemblies(); - - if (!Application.isBatchMode) - { - EditorWindow.focusedWindow.ShowNotification(new GUIContent("Assembly reloading temporarily paused.")); - } - } - else - { - EditorApplication.UnlockReloadAssemblies(); - EditorApplication.delayCall += () => - { - if (!EditorApplication.isUpdating) - { - AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); - } - }; - - if (!Application.isBatchMode) - { - EditorWindow.focusedWindow.ShowNotification(new GUIContent("Assembly reloading resumed.")); - } - } - } - get => locked; - } - } -} diff --git a/Editor/Utilities/EditorAssemblyReloadManager.cs.meta b/Editor/Utilities/EditorAssemblyReloadManager.cs.meta deleted file mode 100644 index 968646b..0000000 --- a/Editor/Utilities/EditorAssemblyReloadManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8b9dee74b1ff4490aa09592ea9710b7d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Utilities/IconEditor.cs b/Editor/Utilities/IconEditor.cs deleted file mode 100644 index 429f904..0000000 --- a/Editor/Utilities/IconEditor.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace RealityCollective.Editor.Utilities -{ - [CanEditMultipleObjects] - [CustomEditor(typeof(DefaultAsset))] - public class IconEditor : UnityEditor.Editor - { - private Texture2D icon; - private string filter; - private string[] filters; - private bool filterFlag; - private bool overwriteIcons; - private MethodInfo getIconForObject; - private MethodInfo setIconForObject; - private MethodInfo forceReloadInspectors; - private MethodInfo copyMonoScriptIconToImporters; - - private void OnEnable() - { - if (getIconForObject == null) - { - getIconForObject = typeof(EditorGUIUtility).GetMethod("GetIconForObject", BindingFlags.NonPublic | BindingFlags.Static); - } - - if (setIconForObject == null) - { - setIconForObject = typeof(EditorGUIUtility).GetMethod("SetIconForObject", BindingFlags.NonPublic | BindingFlags.Static); - } - - if (forceReloadInspectors == null) - { - forceReloadInspectors = typeof(EditorUtility).GetMethod("ForceReloadInspectors", BindingFlags.NonPublic | BindingFlags.Static); - } - - if (copyMonoScriptIconToImporters == null) - { - copyMonoScriptIconToImporters = typeof(MonoImporter).GetMethod("CopyMonoScriptIconToImporters", BindingFlags.NonPublic | BindingFlags.Static); - } - } - - public override void OnInspectorGUI() - { - GUI.enabled = true; - icon = (Texture2D)EditorGUILayout.ObjectField("Icon Texture", icon, typeof(Texture2D), false); - filter = EditorGUILayout.TextField(new GUIContent("Partial name filters", "Use comma separated values for each partial name search."), filter); - filterFlag = EditorGUILayout.Toggle(filterFlag ? "Skipping filter results" : "Targeting filter results", filterFlag); - - EditorGUI.BeginChangeCheck(); - overwriteIcons = EditorGUILayout.Toggle("Overwrite Icon?", overwriteIcons); - - if (GUILayout.Button("Set Icons for child script assets")) - { - filters = !string.IsNullOrEmpty(filter) ? filter.Split(',') : null; - - Object[] selectedAsset = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets); - for (int i = 0; i < selectedAsset.Length; i++) - { - EditorUtility.DisplayProgressBar("Updating Icons...", $"{i} of {selectedAsset.Length} {selectedAsset[i].name}", i / (float)selectedAsset.Length); - var path = AssetDatabase.GetAssetPath(selectedAsset[i]); - if (!path.Contains(".cs")) { continue; } - - if (filters != null) - { - bool matched = filterFlag; - for (int j = 0; j < filters.Length; j++) - { - if (selectedAsset[i].name.ToLower().Contains(filters[j].ToLower())) - { - matched = !filterFlag; - } - } - - if (overwriteIcons && !matched || - !overwriteIcons && matched) - { - continue; - } - } - - SetIcon(selectedAsset[i], icon, overwriteIcons); - } - - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); - EditorUtility.ClearProgressBar(); - } - - GUI.enabled = false; - } - - private void SetIcon(Object selectedObject, Texture2D texture, bool overwrite) - { - var setIcon = (Texture2D)getIconForObject.Invoke(null, new object[] { selectedObject }); - - if (setIcon != null && !overwrite) - { - return; - } - - setIconForObject.Invoke(null, new object[] { selectedObject, texture }); - forceReloadInspectors.Invoke(null, null); - copyMonoScriptIconToImporters.Invoke(null, new object[] { selectedObject as MonoScript }); - } - } -} \ No newline at end of file diff --git a/Editor/Utilities/IconEditor.cs.meta b/Editor/Utilities/IconEditor.cs.meta deleted file mode 100644 index d0222be..0000000 --- a/Editor/Utilities/IconEditor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 86cf78f7662f4c37b541f676e826026f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Utilities/USB.meta b/Editor/Utilities/USB.meta deleted file mode 100644 index c835cb7..0000000 --- a/Editor/Utilities/USB.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: a20ad0205f5066441981c29f990ddb2b -folderAsset: yes -timeCreated: 1512167852 -licenseType: Pro -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Utilities/USB/USBDeviceInfo.cs b/Editor/Utilities/USB/USBDeviceInfo.cs deleted file mode 100644 index 858c65e..0000000 --- a/Editor/Utilities/USB/USBDeviceInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace RealityCollective.Editor.Utilities.USB -{ - [Serializable] - public class USBDeviceInfo - { - public USBDeviceInfo(int vendorId, string udid, int productId, string name, int revision) - { - VendorId = vendorId; - Udid = udid; - ProductId = productId; - Name = name; - Revision = revision; - } - - public int VendorId { get; private set; } - - public string Udid { get; private set; } - - public int ProductId { get; private set; } - - public string Name { get; private set; } - - public int Revision { get; private set; } - } -} \ No newline at end of file diff --git a/Editor/Utilities/USB/USBDeviceInfo.cs.meta b/Editor/Utilities/USB/USBDeviceInfo.cs.meta deleted file mode 100644 index 6d8a4b7..0000000 --- a/Editor/Utilities/USB/USBDeviceInfo.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 24d9956f452444098b553cb1ec5e56a0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Utilities/USB/USBDeviceListener.cs b/Editor/Utilities/USB/USBDeviceListener.cs deleted file mode 100644 index ec0215e..0000000 --- a/Editor/Utilities/USB/USBDeviceListener.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System.Collections.Generic; -using UnityEditor; -using UnityEditor.Hardware; - -namespace RealityCollective.Editor.Utilities.USB -{ - [InitializeOnLoad] - public class USBDeviceListener - { - public static USBDeviceInfo[] USBDevices; - - public delegate void OnUsbDevicesChanged(UsbDevice[] usbDevices); - - public static event OnUsbDevicesChanged UsbDevicesChanged; - - private static readonly List USBDevicesList = new List(0); - - static USBDeviceListener() - { - UnityEditor.Hardware.Usb.DevicesChanged += NotifyUsbDevicesChanged; - } - - private static void NotifyUsbDevicesChanged(UsbDevice[] devices) - { - UsbDevicesChanged?.Invoke(devices); - - USBDevicesList.Clear(); - - foreach (UsbDevice device in devices) - { - USBDevicesList.Add(new USBDeviceInfo(device.vendorId, device.udid, device.productId, device.name, device.revision)); - } - - USBDevices = USBDevicesList.ToArray(); - } - } -} \ No newline at end of file diff --git a/Editor/Utilities/USB/USBDeviceListener.cs.meta b/Editor/Utilities/USB/USBDeviceListener.cs.meta deleted file mode 100644 index bbce71c..0000000 --- a/Editor/Utilities/USB/USBDeviceListener.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8015cc9cfc3242bd9c60bc1e83e29332 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/PropertyDrawers/Vector3RangePropertyDrawer.cs b/Editor/Vector3RangePropertyDrawer.cs similarity index 95% rename from Editor/PropertyDrawers/Vector3RangePropertyDrawer.cs rename to Editor/Vector3RangePropertyDrawer.cs index 2a8c135..3538063 100644 --- a/Editor/PropertyDrawers/Vector3RangePropertyDrawer.cs +++ b/Editor/Vector3RangePropertyDrawer.cs @@ -1,11 +1,11 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using RealityCollective.Attributes; +using RealityCollective.Utilities.Attributes; using UnityEditor; using UnityEngine; -namespace RealityCollective.Editor.PropertyDrawers +namespace RealityCollective.Utilities.Editor { /// /// Custom property drawer for decorated values rendered in the inspector. diff --git a/Editor/PropertyDrawers/Vector3RangePropertyDrawer.cs.meta b/Editor/Vector3RangePropertyDrawer.cs.meta similarity index 74% rename from Editor/PropertyDrawers/Vector3RangePropertyDrawer.cs.meta rename to Editor/Vector3RangePropertyDrawer.cs.meta index 5a1fcf9..15ee384 100644 --- a/Editor/PropertyDrawers/Vector3RangePropertyDrawer.cs.meta +++ b/Editor/Vector3RangePropertyDrawer.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/README.md b/README.md index 4cc3854..be5d1a8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Reality Toolkit - utilities Platform Module +![com.realitycollective.utilities](https://github.com/realitycollective/realitycollective.logo/blob/main/RealityCollective/RepoBanners/com.realitycollective.utilities.png?raw=true) + A collection of useful utilities for Unity Projects by the Reality Collective. Useful for any Unity Project to accelerate and code safely within Unity. [![openupm](https://img.shields.io/npm/v/com.realitycollective.utilities?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.realitycollective.utilities/) @@ -28,13 +30,13 @@ A collection of useful utilities for Unity Projects by the Reality Collective. * ComponentExtensions * ConverterExtensions * DoubleExtensions -* EnumerableExtensions * EnumExtensions +* EnumerableExtensions * FloatExtensions * GameObjectExtensions -* HandednessExtensions * LayerExtensions * MathfExtensions +* MatrixExtensions * ProcessExtensions * QuaternionExtensions * RayExtensions @@ -43,42 +45,26 @@ A collection of useful utilities for Unity Projects by the Reality Collective. * SystemNumericsExtensions * TextureExtensions * TransformExtensions -* TypeExtensions * UnityObjectExtensions * VectorExtensions -### Reusable definitions - -* AnimatorParameter -* AutoStartBehavior -* AxisType -* CardinalAxis -* CollationOrderType -* FlattenMode -* Handedness -* OrientationType -* PivotAxis -* ProcessResult -* QuaternionSmoothed -* RecognitionConfidenceLevel -* RenderPipeline -* RotationConstraintType -* ScaleStateType -* SystemType -* TypeGrouping -* Vector3Smoothed - ### Property Attributes * EnumFlagsAttribute -* ExtendsAttribute * Il2CppSetOptionAttribute * ImplementsAttribute * PhysicsLayerAttribute * PrefabAttribute -* SystemTypeAttribute * Vector3RangeAttribute +### Functional Utilities + +The Utilities package includes a well-formed logging solution that is single instanced and can optionally connect to Unity log events, useful for tracking both application and Unity logs and dramatically reduces the default Unity logging. Also includes options to set whether debug logs should be output. + +* StaticLogger - A single instance logging solution for capturing, saving and exposing logged events from both Unity and the Application. +* CaptureApplicationLog - A static router to push Unity events direct from a Unity scene. +* FilterLogType - A filtering definition to limit what logs are captured / exposed + ## Requirements diff --git a/Runtime/AssemblyInfo.cs b/Runtime/AssemblyInfo.cs index 0bb5d68..c83c8b0 100644 --- a/Runtime/AssemblyInfo.cs +++ b/Runtime/AssemblyInfo.cs @@ -3,7 +3,7 @@ using System.Reflection; -[assembly: AssemblyVersion("1.0.10")] +[assembly: AssemblyVersion("1.0.11")] [assembly: AssemblyTitle("com.realitycollective.utilities")] [assembly: AssemblyCompany("Reality Collective")] [assembly: AssemblyCopyright("Copyright (c) Reality Collective. All rights reserved.")] diff --git a/Runtime/Utilities/Async.meta b/Runtime/Async.meta similarity index 100% rename from Runtime/Utilities/Async.meta rename to Runtime/Async.meta diff --git a/Runtime/Utilities/Async/AwaitYieldInstructions.meta b/Runtime/Async/AwaitYieldInstructions.meta similarity index 100% rename from Runtime/Utilities/Async/AwaitYieldInstructions.meta rename to Runtime/Async/AwaitYieldInstructions.meta diff --git a/Runtime/Utilities/Async/AwaitYieldInstructions/BackgroundThread.cs b/Runtime/Async/AwaitYieldInstructions/BackgroundThread.cs similarity index 100% rename from Runtime/Utilities/Async/AwaitYieldInstructions/BackgroundThread.cs rename to Runtime/Async/AwaitYieldInstructions/BackgroundThread.cs diff --git a/Runtime/Utilities/Async/AwaitYieldInstructions/BackgroundThread.cs.meta b/Runtime/Async/AwaitYieldInstructions/BackgroundThread.cs.meta similarity index 74% rename from Runtime/Utilities/Async/AwaitYieldInstructions/BackgroundThread.cs.meta rename to Runtime/Async/AwaitYieldInstructions/BackgroundThread.cs.meta index 43ea180..67edf84 100644 --- a/Runtime/Utilities/Async/AwaitYieldInstructions/BackgroundThread.cs.meta +++ b/Runtime/Async/AwaitYieldInstructions/BackgroundThread.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Utilities/Async/AwaitYieldInstructions/UnityMainThread.cs b/Runtime/Async/AwaitYieldInstructions/UnityMainThread.cs similarity index 100% rename from Runtime/Utilities/Async/AwaitYieldInstructions/UnityMainThread.cs rename to Runtime/Async/AwaitYieldInstructions/UnityMainThread.cs diff --git a/Runtime/Utilities/Async/AwaitYieldInstructions/UnityMainThread.cs.meta b/Runtime/Async/AwaitYieldInstructions/UnityMainThread.cs.meta similarity index 74% rename from Runtime/Utilities/Async/AwaitYieldInstructions/UnityMainThread.cs.meta rename to Runtime/Async/AwaitYieldInstructions/UnityMainThread.cs.meta index 083ea77..70496c6 100644 --- a/Runtime/Utilities/Async/AwaitYieldInstructions/UnityMainThread.cs.meta +++ b/Runtime/Async/AwaitYieldInstructions/UnityMainThread.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Utilities/Async/AwaiterExtensions.cs b/Runtime/Async/AwaiterExtensions.cs similarity index 99% rename from Runtime/Utilities/Async/AwaiterExtensions.cs rename to Runtime/Async/AwaiterExtensions.cs index 62c622b..eba0415 100644 --- a/Runtime/Utilities/Async/AwaiterExtensions.cs +++ b/Runtime/Async/AwaiterExtensions.cs @@ -1,4 +1,4 @@ -// MIT License +// MIT License // Copyright(c) 2016 Modest Tree Media Inc @@ -20,9 +20,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using RealityCollective.Extensions; using RealityCollective.Utilities.Async.AwaitYieldInstructions; using RealityCollective.Utilities.Async.Internal; +using RealityCollective.Utilities.Extensions; using System; using System.Collections; using System.Collections.Generic; diff --git a/Runtime/Utilities/Async/AwaiterExtensions.cs.meta b/Runtime/Async/AwaiterExtensions.cs.meta similarity index 74% rename from Runtime/Utilities/Async/AwaiterExtensions.cs.meta rename to Runtime/Async/AwaiterExtensions.cs.meta index 350b954..1ff4b5c 100644 --- a/Runtime/Utilities/Async/AwaiterExtensions.cs.meta +++ b/Runtime/Async/AwaiterExtensions.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Utilities/Async/Awaiters.cs b/Runtime/Async/Awaiters.cs similarity index 100% rename from Runtime/Utilities/Async/Awaiters.cs rename to Runtime/Async/Awaiters.cs diff --git a/Runtime/Utilities/Async/Awaiters.cs.meta b/Runtime/Async/Awaiters.cs.meta similarity index 74% rename from Runtime/Utilities/Async/Awaiters.cs.meta rename to Runtime/Async/Awaiters.cs.meta index 1e0b313..66b5be4 100644 --- a/Runtime/Utilities/Async/Awaiters.cs.meta +++ b/Runtime/Async/Awaiters.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Utilities/Async/Internal.meta b/Runtime/Async/Internal.meta similarity index 100% rename from Runtime/Utilities/Async/Internal.meta rename to Runtime/Async/Internal.meta diff --git a/Runtime/Utilities/Async/Internal/SyncContextUtility.cs b/Runtime/Async/Internal/SyncContextUtility.cs similarity index 100% rename from Runtime/Utilities/Async/Internal/SyncContextUtility.cs rename to Runtime/Async/Internal/SyncContextUtility.cs diff --git a/Runtime/Utilities/Async/Internal/SyncContextUtility.cs.meta b/Runtime/Async/Internal/SyncContextUtility.cs.meta similarity index 74% rename from Runtime/Utilities/Async/Internal/SyncContextUtility.cs.meta rename to Runtime/Async/Internal/SyncContextUtility.cs.meta index 33724bd..bb46a18 100644 --- a/Runtime/Utilities/Async/Internal/SyncContextUtility.cs.meta +++ b/Runtime/Async/Internal/SyncContextUtility.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Utilities/Async/License.md b/Runtime/Async/License.md similarity index 100% rename from Runtime/Utilities/Async/License.md rename to Runtime/Async/License.md diff --git a/Runtime/Utilities/Async/License.md.meta b/Runtime/Async/License.md.meta similarity index 100% rename from Runtime/Utilities/Async/License.md.meta rename to Runtime/Async/License.md.meta diff --git a/Runtime/Utilities/Async/ReadMe.md b/Runtime/Async/ReadMe.md similarity index 100% rename from Runtime/Utilities/Async/ReadMe.md rename to Runtime/Async/ReadMe.md diff --git a/Runtime/Utilities/Async/ReadMe.md.meta b/Runtime/Async/ReadMe.md.meta similarity index 100% rename from Runtime/Utilities/Async/ReadMe.md.meta rename to Runtime/Async/ReadMe.md.meta diff --git a/Runtime/Attributes/EnumFlagsAttribute.cs b/Runtime/Attributes/EnumFlagsAttribute.cs index f1b61b3..3b9607e 100644 --- a/Runtime/Attributes/EnumFlagsAttribute.cs +++ b/Runtime/Attributes/EnumFlagsAttribute.cs @@ -4,7 +4,7 @@ using System; using UnityEngine; -namespace RealityCollective.Attributes +namespace RealityCollective.Utilities.Attributes { /// /// From https://answers.unity.com/questions/486694/default-editor-enum-as-flags-.html diff --git a/Runtime/Attributes/EnumFlagsAttribute.cs.meta b/Runtime/Attributes/EnumFlagsAttribute.cs.meta index d3f4109..9ba335e 100644 --- a/Runtime/Attributes/EnumFlagsAttribute.cs.meta +++ b/Runtime/Attributes/EnumFlagsAttribute.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Attributes/Il2CppSetOptionAttribute.cs b/Runtime/Attributes/Il2CppSetOptionAttribute.cs index 68674db..4b54c23 100644 --- a/Runtime/Attributes/Il2CppSetOptionAttribute.cs +++ b/Runtime/Attributes/Il2CppSetOptionAttribute.cs @@ -1,14 +1,17 @@ -// Copyright (c) Reality Collective. All rights reserved. +// Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; -namespace Unity.IL2CPP.CompilerServices +namespace RealityCollective.Utilities.Attributes { /// /// The code generation options available for IL to C++ conversion. /// Enable or disabled these with caution. /// + /// + /// + /// public enum Option { /// @@ -62,6 +65,9 @@ public enum Option /// return tmp.ToString(); /// } /// + /// + /// + /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] public class Il2CppSetOptionAttribute : Attribute { diff --git a/Runtime/Attributes/Il2CppSetOptionAttribute.cs.meta b/Runtime/Attributes/Il2CppSetOptionAttribute.cs.meta index 3edac43..704f5ba 100644 --- a/Runtime/Attributes/Il2CppSetOptionAttribute.cs.meta +++ b/Runtime/Attributes/Il2CppSetOptionAttribute.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Attributes/PhysicsLayerAttribute.cs b/Runtime/Attributes/PhysicsLayerAttribute.cs index e8fe314..ca5910c 100644 --- a/Runtime/Attributes/PhysicsLayerAttribute.cs +++ b/Runtime/Attributes/PhysicsLayerAttribute.cs @@ -4,7 +4,7 @@ using System; using UnityEngine; -namespace RealityCollective.Attributes +namespace RealityCollective.Utilities.Attributes { /// /// Attribute used to make an field render a dropdown generated from the current layers defined in the Tag Manager. diff --git a/Runtime/Attributes/PhysicsLayerAttribute.cs.meta b/Runtime/Attributes/PhysicsLayerAttribute.cs.meta index 51012b3..0ada252 100644 --- a/Runtime/Attributes/PhysicsLayerAttribute.cs.meta +++ b/Runtime/Attributes/PhysicsLayerAttribute.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Attributes/PrefabAttribute.cs b/Runtime/Attributes/PrefabAttribute.cs index 9c98034..f1082d6 100644 --- a/Runtime/Attributes/PrefabAttribute.cs +++ b/Runtime/Attributes/PrefabAttribute.cs @@ -4,7 +4,7 @@ using System; using UnityEngine; -namespace RealityCollective.Attributes +namespace RealityCollective.Utilities.Attributes { /// /// Attribute used to ensure that a GameObject inspector slot only accepts prefabs. diff --git a/Runtime/Attributes/PrefabAttribute.cs.meta b/Runtime/Attributes/PrefabAttribute.cs.meta index 35b8ef8..4557cd4 100644 --- a/Runtime/Attributes/PrefabAttribute.cs.meta +++ b/Runtime/Attributes/PrefabAttribute.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Attributes/Vector3RangeAttribute.cs b/Runtime/Attributes/Vector3RangeAttribute.cs index 1c246eb..ba48884 100644 --- a/Runtime/Attributes/Vector3RangeAttribute.cs +++ b/Runtime/Attributes/Vector3RangeAttribute.cs @@ -4,7 +4,7 @@ using System; using UnityEngine; -namespace RealityCollective.Attributes +namespace RealityCollective.Utilities.Attributes { /// /// Attribute used to make a float or int variable in a script be restricted to a specific range. diff --git a/Runtime/Attributes/Vector3RangeAttribute.cs.meta b/Runtime/Attributes/Vector3RangeAttribute.cs.meta index 0699bcf..222f0ec 100644 --- a/Runtime/Attributes/Vector3RangeAttribute.cs.meta +++ b/Runtime/Attributes/Vector3RangeAttribute.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/CardinalAxis.cs b/Runtime/Definitions/CardinalAxis.cs similarity index 91% rename from Runtime/Definitions/Utilities/CardinalAxis.cs rename to Runtime/Definitions/CardinalAxis.cs index afa97a6..6ede262 100644 --- a/Runtime/Definitions/Utilities/CardinalAxis.cs +++ b/Runtime/Definitions/CardinalAxis.cs @@ -3,7 +3,7 @@ using System; -namespace RealityCollective.Definitions.Utilities +namespace RealityCollective.Utilities.Definitions { /// /// Enum which describes cardinal axes diff --git a/Runtime/Definitions/Utilities/CardinalAxis.cs.meta b/Runtime/Definitions/CardinalAxis.cs.meta similarity index 74% rename from Runtime/Definitions/Utilities/CardinalAxis.cs.meta rename to Runtime/Definitions/CardinalAxis.cs.meta index 392a79d..a6b9ef4 100644 --- a/Runtime/Definitions/Utilities/CardinalAxis.cs.meta +++ b/Runtime/Definitions/CardinalAxis.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/ProcessResult.cs b/Runtime/Definitions/ProcessResult.cs similarity index 95% rename from Runtime/Definitions/Utilities/ProcessResult.cs rename to Runtime/Definitions/ProcessResult.cs index 0441d59..6376f04 100644 --- a/Runtime/Definitions/Utilities/ProcessResult.cs +++ b/Runtime/Definitions/ProcessResult.cs @@ -1,7 +1,7 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace RealityCollective.Definitions.Utilities +namespace RealityCollective.Utilities.Definitions { /// /// Result from a completed asynchronous process. diff --git a/Runtime/Definitions/Utilities/ProcessResult.cs.meta b/Runtime/Definitions/ProcessResult.cs.meta similarity index 74% rename from Runtime/Definitions/Utilities/ProcessResult.cs.meta rename to Runtime/Definitions/ProcessResult.cs.meta index 4357988..cd14a8e 100644 --- a/Runtime/Definitions/Utilities/ProcessResult.cs.meta +++ b/Runtime/Definitions/ProcessResult.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Definitions/Utilities.meta b/Runtime/Definitions/Utilities.meta deleted file mode 100644 index e9dd2f5..0000000 --- a/Runtime/Definitions/Utilities.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c45d482ffdda4d83aefb40bcab008e87 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/AnimatorParameter.cs b/Runtime/Definitions/Utilities/AnimatorParameter.cs deleted file mode 100644 index 4824d34..0000000 --- a/Runtime/Definitions/Utilities/AnimatorParameter.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using UnityEngine; - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// A copy of the because that class is not Serializable and cannot be modified in the editor. - /// - [Serializable] - public struct AnimatorParameter - { - /// - /// Constructor. - /// - /// Name of the animation parameter to modify. - /// Type of the animation parameter to modify. - /// If the animation parameter type is an int, value to set. Ignored otherwise. - /// If the animation parameter type is a float, value to set. Ignored otherwise. - /// "If the animation parameter type is a bool, value to set. Ignored otherwise. - public AnimatorParameter(string name, AnimatorControllerParameterType parameterType, int defaultInt = 0, float defaultFloat = 0f, bool defaultBool = false) - { - this.parameterType = parameterType; - this.defaultInt = defaultInt; - this.defaultFloat = defaultFloat; - this.defaultBool = defaultBool; - this.name = name; - nameStringHash = null; - } - - [SerializeField] - [Tooltip("Type of the animation parameter to modify.")] - private AnimatorControllerParameterType parameterType; - - /// - /// Type of the animation parameter to modify. - /// - public AnimatorControllerParameterType ParameterType => parameterType; - - [SerializeField] - [Tooltip("If the animation parameter type is an int, value to set. Ignored otherwise.")] - private int defaultInt; - - /// - /// If the animation parameter type is an int, value to set. Ignored otherwise. - /// - public int DefaultInt => defaultInt; - - [SerializeField] - [Tooltip("If the animation parameter type is a float, value to set. Ignored otherwise.")] - private float defaultFloat; - - /// - /// If the animation parameter type is a float, value to set. Ignored otherwise. - /// - public float DefaultFloat => defaultFloat; - - [SerializeField] - [Tooltip("If the animation parameter type is a bool, value to set. Ignored otherwise.")] - private bool defaultBool; - - /// - /// If the animation parameter type is a bool, value to set. Ignored otherwise. - /// - public bool DefaultBool => defaultBool; - - [SerializeField] - [Tooltip("Name of the animation parameter to modify.")] - private string name; - - /// - /// Name of the animation parameter to modify. - /// - public string Name => name; - - private int? nameStringHash; - - /// - /// Animator Name String to Hash. - /// - public int NameHash - { - get - { - if (!nameStringHash.HasValue && !string.IsNullOrEmpty(Name)) - { - nameStringHash = Animator.StringToHash(Name); - } - - Debug.Assert(nameStringHash != null); - return nameStringHash.Value; - } - } - } -} diff --git a/Runtime/Definitions/Utilities/AnimatorParameter.cs.meta b/Runtime/Definitions/Utilities/AnimatorParameter.cs.meta deleted file mode 100644 index c1e9ca6..0000000 --- a/Runtime/Definitions/Utilities/AnimatorParameter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a80c6185462b4c728089744f178c941f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/AutoStartBehavior.cs b/Runtime/Definitions/Utilities/AutoStartBehavior.cs deleted file mode 100644 index 4db40d9..0000000 --- a/Runtime/Definitions/Utilities/AutoStartBehavior.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// This enumeration identifies different ways to handle the startup behavior for a feature. - /// - public enum AutoStartBehavior - { - /// - /// Automatically start the feature. - /// - AutoStart = 0, - /// - /// Delay the start of the feature until the user requests it to begin. - /// - ManualStart - } -} diff --git a/Runtime/Definitions/Utilities/AutoStartBehavior.cs.meta b/Runtime/Definitions/Utilities/AutoStartBehavior.cs.meta deleted file mode 100644 index fd6dab7..0000000 --- a/Runtime/Definitions/Utilities/AutoStartBehavior.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4a1e042abf6140a8929a44c9f6174346 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/AxisType.cs b/Runtime/Definitions/Utilities/AxisType.cs deleted file mode 100644 index f8b842d..0000000 --- a/Runtime/Definitions/Utilities/AxisType.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// The AxisType identifies the type of button or input being sent to the framework from a controller. - /// This is mainly information only or for advanced users to understand the input coming directly from the controller. - /// - public enum AxisType - { - /// - /// No Specified type. - /// - None = 0, - /// - /// Raw stream from input (proxy only). - /// - Raw, - /// - /// Digital On/Off UnityEngine.Input. - /// - Digital, - /// - /// Single Axis analogue UnityEngine.Input. - /// - SingleAxis, - /// - /// Dual Axis analogue UnityEngine.Input. - /// - DualAxis, - /// - /// Position only Axis analogue UnityEngine.Input. - /// - ThreeDofPosition, - /// - /// Rotation only Axis analogue UnityEngine.Input. - /// - ThreeDofRotation, - /// - /// Position AND Rotation analogue UnityEngine.Input. - /// - SixDof - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/AxisType.cs.meta b/Runtime/Definitions/Utilities/AxisType.cs.meta deleted file mode 100644 index 6f99dfd..0000000 --- a/Runtime/Definitions/Utilities/AxisType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 062096f020324e21aa0ea2eb041f371a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/CollationOrderType.cs b/Runtime/Definitions/Utilities/CollationOrderType.cs deleted file mode 100644 index 0ba20c1..0000000 --- a/Runtime/Definitions/Utilities/CollationOrderType.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// Collation order type used for sorting - /// - public enum CollationOrderType - { - /// - /// Don't sort, just display in order received - /// - None = 0, - /// - /// Sort by child order of parent - /// - ChildOrder, - /// - /// Sort by transform name - /// - Alphabetical, - /// - /// Sort by child order of parent, reversed - /// - ChildOrderReversed, - /// - /// Sort by transform name, reversed - /// - AlphabeticalReversed - } -} diff --git a/Runtime/Definitions/Utilities/CollationOrderType.cs.meta b/Runtime/Definitions/Utilities/CollationOrderType.cs.meta deleted file mode 100644 index 291e5b2..0000000 --- a/Runtime/Definitions/Utilities/CollationOrderType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c593391b2b67443e8f712e69141d3848 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/FlattenMode.cs b/Runtime/Definitions/Utilities/FlattenMode.cs deleted file mode 100644 index 335409d..0000000 --- a/Runtime/Definitions/Utilities/FlattenMode.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// Enum which describes how an object is to be flattened. - /// - public enum FlattenMode - { - DoNotFlatten = 0, - /// - /// Flatten the X axis - /// - FlattenX, - /// - /// Flatten the Y axis - /// - FlattenY, - /// - /// Flatten the Z axis - /// - FlattenZ, - /// - /// Flatten the smallest relative axis if it falls below threshold - /// - FlattenAuto, - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/FlattenMode.cs.meta b/Runtime/Definitions/Utilities/FlattenMode.cs.meta deleted file mode 100644 index 1cc051d..0000000 --- a/Runtime/Definitions/Utilities/FlattenMode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7da0a2214976083499fa1cbb7d8b0396 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/Handedness.cs b/Runtime/Definitions/Utilities/Handedness.cs deleted file mode 100644 index 8b83187..0000000 --- a/Runtime/Definitions/Utilities/Handedness.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// The Handedness defines which hand a controller is currently operating in. - /// It is up to the developer to determine whether this affects the use of a controller or not. - /// "Other" defines potential controllers that will offer a "third" hand, e.g. a full body tracking suit. - /// - [Flags] - public enum Handedness - { - /// - /// No hand specified by the SDK for the controller - /// - None = 0, - /// - /// The controller is identified as being provided in a Left hand - /// - Left = 1 << 0, - /// - /// The controller is identified as being provided in a Right hand - /// - Right = 1 << 1, - /// - /// The controller is identified as being either left and/or right handed. - /// - Both = Left | Right, - /// - /// Reserved, for systems that provide alternate hand state. - /// - Other = 1 << 2, - /// - /// Global catchall, used to map actions to any controller (provided the controller supports it) - /// - /// Note, by default the specific hand actions will override settings mapped as both - Any = Other | Left | Right, - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/Handedness.cs.meta b/Runtime/Definitions/Utilities/Handedness.cs.meta deleted file mode 100644 index 1d344e7..0000000 --- a/Runtime/Definitions/Utilities/Handedness.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 171b010dcfef436fa3b923538bd7a141 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/OrientationType.cs b/Runtime/Definitions/Utilities/OrientationType.cs deleted file mode 100644 index 2a2bc6e..0000000 --- a/Runtime/Definitions/Utilities/OrientationType.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// Orientation type enum - /// - public enum OrientationType - { - /// - /// Don't rotate at all - /// - None = 0, - /// - /// Rotate towards the origin - /// - FaceOrigin, - /// - /// Rotate towards the origin + 180 degrees - /// - FaceOriginReversed, - /// - /// Zero rotation - /// - FaceParentFoward, - /// - /// Zero rotation + 180 degrees - /// - FaceParentForwardReversed, - /// - /// Parent Relative Up - /// - FaceParentUp, - /// - /// Parent Relative Down - /// - FaceParentDown, - /// - /// Lay flat on the surface, facing in - /// - FaceCenterAxis, - /// - /// Lay flat on the surface, facing out - /// - FaceCenterAxisReversed - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/OrientationType.cs.meta b/Runtime/Definitions/Utilities/OrientationType.cs.meta deleted file mode 100644 index bdcf66e..0000000 --- a/Runtime/Definitions/Utilities/OrientationType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8a33cf52c37646b2b3cef9cfd3a9345b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/PivotAxis.cs b/Runtime/Definitions/Utilities/PivotAxis.cs deleted file mode 100644 index eef6f0d..0000000 --- a/Runtime/Definitions/Utilities/PivotAxis.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// Rotational Pivot axis for orientating an object - /// - public enum PivotAxis - { - // Most common options, preserving current functionality with the same enum order. - XY, - Y, - // Rotate about an individual axis. - X, - Z, - // Rotate about a pair of axes. - XZ, - YZ, - // Rotate about all axes. - Free - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/PivotAxis.cs.meta b/Runtime/Definitions/Utilities/PivotAxis.cs.meta deleted file mode 100644 index 38956b2..0000000 --- a/Runtime/Definitions/Utilities/PivotAxis.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5fb59d46d33b499b830e2433c72eb488 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/QuaternionSmoothed.cs b/Runtime/Definitions/Utilities/QuaternionSmoothed.cs deleted file mode 100644 index 03685be..0000000 --- a/Runtime/Definitions/Utilities/QuaternionSmoothed.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using UnityEngine; - -namespace RealityCollective.Definitions.Utilities -{ - [Serializable] - public struct QuaternionSmoothed - { - public Quaternion Current { get; set; } - public Quaternion Goal { get; set; } - public float SmoothTime { get; set; } - - public QuaternionSmoothed(Quaternion value, float smoothingTime) : this() - { - Current = value; - Goal = value; - SmoothTime = smoothingTime; - } - - public void Update(float deltaTime) - { - Current = Quaternion.Slerp(Current, Goal, (Math.Abs(SmoothTime) < Mathf.Epsilon) ? 1.0f : deltaTime / SmoothTime); - } - - public void SetGoal(Quaternion newGoal) - { - Goal = newGoal; - } - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/QuaternionSmoothed.cs.meta b/Runtime/Definitions/Utilities/QuaternionSmoothed.cs.meta deleted file mode 100644 index cf0d557..0000000 --- a/Runtime/Definitions/Utilities/QuaternionSmoothed.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c863f825ccd144909f26979b6d089ce9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/RecognitionConfidenceLevel.cs b/Runtime/Definitions/Utilities/RecognitionConfidenceLevel.cs deleted file mode 100644 index a21f74c..0000000 --- a/Runtime/Definitions/Utilities/RecognitionConfidenceLevel.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// Indicates the confidence level of a recognized event. - /// - public enum RecognitionConfidenceLevel - { - High = 0, - Medium, - Low, - Unknown - } -} diff --git a/Runtime/Definitions/Utilities/RecognitionConfidenceLevel.cs.meta b/Runtime/Definitions/Utilities/RecognitionConfidenceLevel.cs.meta deleted file mode 100644 index 421a0fc..0000000 --- a/Runtime/Definitions/Utilities/RecognitionConfidenceLevel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 89b02bd20d5f41cd86237edc05136dfe -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/RenderPipeline.cs b/Runtime/Definitions/Utilities/RenderPipeline.cs deleted file mode 100644 index defca4c..0000000 --- a/Runtime/Definitions/Utilities/RenderPipeline.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - /// - /// Available render pipelines for use in Unity applications. - /// - public enum RenderPipeline - { - /// - /// The legacy "built-in" render pipeline of Unity that was deprecated - /// when scriptable render pipelines were introduced. - /// - Legacy = 0, - /// - /// The universal render pipeline, formerly also known as lightweight render pipeline. - /// - UniversalRenderPipeline, - /// - /// The high definition pipeline. - /// - HighDefinitionRenderPipeline, - /// - /// A customized scriptable render pipeline. - /// - Custom - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/RenderPipeline.cs.meta b/Runtime/Definitions/Utilities/RenderPipeline.cs.meta deleted file mode 100644 index 27df4ea..0000000 --- a/Runtime/Definitions/Utilities/RenderPipeline.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 42fc4a1663d5ed446a02d84a1684b2d5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/RotationConstraintType.cs b/Runtime/Definitions/Utilities/RotationConstraintType.cs deleted file mode 100644 index d88baec..0000000 --- a/Runtime/Definitions/Utilities/RotationConstraintType.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - public enum RotationConstraintType - { - None, - XAxisOnly, - YAxisOnly, - ZAxisOnly - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/RotationConstraintType.cs.meta b/Runtime/Definitions/Utilities/RotationConstraintType.cs.meta deleted file mode 100644 index 8f1563d..0000000 --- a/Runtime/Definitions/Utilities/RotationConstraintType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9b3ad4e43b734d36a836533c115392ed -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/ScaleStateType.cs b/Runtime/Definitions/Utilities/ScaleStateType.cs deleted file mode 100644 index 9d3ae32..0000000 --- a/Runtime/Definitions/Utilities/ScaleStateType.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -namespace RealityCollective.Definitions.Utilities -{ - public enum ScaleStateType - { - Static = 0, - Shrinking, - Growing - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/ScaleStateType.cs.meta b/Runtime/Definitions/Utilities/ScaleStateType.cs.meta deleted file mode 100644 index e8c26fa..0000000 --- a/Runtime/Definitions/Utilities/ScaleStateType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bc14b8263252449c93fc1e61ff1127e5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/Vector3Smoothed.cs b/Runtime/Definitions/Utilities/Vector3Smoothed.cs deleted file mode 100644 index 7b52808..0000000 --- a/Runtime/Definitions/Utilities/Vector3Smoothed.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using System; -using UnityEngine; - -namespace RealityCollective.Definitions.Utilities -{ - [Serializable] - public struct Vector3Smoothed - { - public Vector3 Current { get; set; } - public Vector3 Goal { get; set; } - public float SmoothTime { get; set; } - - public Vector3Smoothed(Vector3 value, float smoothingTime) : this() - { - Current = value; - Goal = value; - SmoothTime = smoothingTime; - } - - public void Update(float deltaTime) - { - Current = Vector3.Lerp(Current, Goal, (Math.Abs(SmoothTime) < Mathf.Epsilon) ? 1.0f : deltaTime / SmoothTime); - } - - public void SetGoal(Vector3 newGoal) - { - Goal = newGoal; - } - } -} \ No newline at end of file diff --git a/Runtime/Definitions/Utilities/Vector3Smoothed.cs.meta b/Runtime/Definitions/Utilities/Vector3Smoothed.cs.meta deleted file mode 100644 index ef551ec..0000000 --- a/Runtime/Definitions/Utilities/Vector3Smoothed.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3f8d34b94a6b40fd86ea8798242350fb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Extensions/AnimationCurveExtensions.cs b/Runtime/Extensions/AnimationCurveExtensions.cs index 3369db3..4ad6eba 100644 --- a/Runtime/Extensions/AnimationCurveExtensions.cs +++ b/Runtime/Extensions/AnimationCurveExtensions.cs @@ -3,7 +3,7 @@ using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's AnimationCurve class diff --git a/Runtime/Extensions/AnimationCurveExtensions.cs.meta b/Runtime/Extensions/AnimationCurveExtensions.cs.meta index 3a1d90b..f006be8 100644 --- a/Runtime/Extensions/AnimationCurveExtensions.cs.meta +++ b/Runtime/Extensions/AnimationCurveExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/ArrayExtensions.cs b/Runtime/Extensions/ArrayExtensions.cs index 5c2885b..de0bc85 100644 --- a/Runtime/Extensions/ArrayExtensions.cs +++ b/Runtime/Extensions/ArrayExtensions.cs @@ -3,7 +3,7 @@ using System; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// type method extensions. diff --git a/Runtime/Extensions/ArrayExtensions.cs.meta b/Runtime/Extensions/ArrayExtensions.cs.meta index 25450ad..b5b01d7 100644 --- a/Runtime/Extensions/ArrayExtensions.cs.meta +++ b/Runtime/Extensions/ArrayExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/AssemblyExtensions.cs b/Runtime/Extensions/AssemblyExtensions.cs index 4e0bbbc..d542bb2 100644 --- a/Runtime/Extensions/AssemblyExtensions.cs +++ b/Runtime/Extensions/AssemblyExtensions.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Reflection; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { public static class AssemblyExtensions { diff --git a/Runtime/Extensions/AssemblyExtensions.cs.meta b/Runtime/Extensions/AssemblyExtensions.cs.meta index da1b748..c3a6b8a 100644 --- a/Runtime/Extensions/AssemblyExtensions.cs.meta +++ b/Runtime/Extensions/AssemblyExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/BoundsExtensions.cs b/Runtime/Extensions/BoundsExtensions.cs index bfa0ddc..01567b7 100644 --- a/Runtime/Extensions/BoundsExtensions.cs +++ b/Runtime/Extensions/BoundsExtensions.cs @@ -1,11 +1,12 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using RealityCollective.Utilities.Definitions; using System.Collections.Generic; -using RealityCollective.Definitions.Utilities; using UnityEngine; +using UnityEngine.Assertions; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's @@ -64,6 +65,28 @@ public static class BoundsExtensions private static readonly Vector3[] rectTransformCorners = new Vector3[4]; + // Axis of the capsule’s lengthwise orientation in the object’s local space + private const int CAPSULE_X_AXIS = 0; + private const int CAPSULE_Y_AXIS = 1; + private const int CAPSULE_Z_AXIS = 2; + + // Edges used to render the bounds. + private static readonly int[] boundsEdges = new int[] + { + LBF, LBB, + LBB, LTB, + LTB, LTF, + LTF, LBF, + LBF, RTB, + RTB, RTF, + RTF, RBF, + RBF, RBB, + RBB, RTB, + RTF, LBB, + RBF, LTB, + RBB, LTF + }; + #region Public Static Functions /// @@ -152,6 +175,46 @@ public static void GetCornerPositionsLocalSpace(this Bounds bounds, ref Vector3[ } } + /// + /// Gets all the corner points of the bounds in world space by transforming input bounds using the given transform + /// + /// Local to world transform + /// Output corner positions + /// Input bounds, in local space + /// + /// Use BoxColliderExtensions.{Left|Right}{Bottom|Top}{Front|Back} consts to index into the output + /// corners array. + /// + public static void GetCornerPositions(this Bounds bounds, Transform transform, ref Vector3[] positions) + { + // Calculate the local points to transform. + Vector3 center = bounds.center; + Vector3 extents = bounds.extents; + float leftEdge = center.x - extents.x; + float rightEdge = center.x + extents.x; + float bottomEdge = center.y - extents.y; + float topEdge = center.y + extents.y; + float frontEdge = center.z - extents.z; + float backEdge = center.z + extents.z; + + // Allocate the array if needed. + const int numPoints = 8; + if (positions == null || positions.Length != numPoints) + { + positions = new Vector3[numPoints]; + } + + // Transform all the local points to world space. + positions[LBF] = transform.TransformPoint(leftEdge, bottomEdge, frontEdge); + positions[LBB] = transform.TransformPoint(leftEdge, bottomEdge, backEdge); + positions[LTF] = transform.TransformPoint(leftEdge, topEdge, frontEdge); + positions[LTB] = transform.TransformPoint(leftEdge, topEdge, backEdge); + positions[RBF] = transform.TransformPoint(rightEdge, bottomEdge, frontEdge); + positions[RBB] = transform.TransformPoint(rightEdge, bottomEdge, backEdge); + positions[RTF] = transform.TransformPoint(rightEdge, topEdge, frontEdge); + positions[RTB] = transform.TransformPoint(rightEdge, topEdge, backEdge); + } + /// /// Gets all the corner points of the bounds. /// @@ -191,11 +254,35 @@ public static void GetCornerPositions(this Bounds bounds, ref Vector3[] position } /// - /// Gets all the face points of the bounds. + /// Gets all the corner points from Renderer's Bounds /// - /// The input bounding volume. - /// A relative transform point. - /// A reference array of 8 points to populate. + public static void GetCornerPositionsFromRendererBounds(this Bounds bounds, ref Vector3[] positions) + { + Vector3 center = bounds.center; + Vector3 extents = bounds.extents; + float leftEdge = center.x - extents.x; + float rightEdge = center.x + extents.x; + float bottomEdge = center.y - extents.y; + float topEdge = center.y + extents.y; + float frontEdge = center.z - extents.z; + float backEdge = center.z + extents.z; + + const int numPoints = 8; + if (positions == null || positions.Length != numPoints) + { + positions = new Vector3[numPoints]; + } + + positions[LBF] = new Vector3(leftEdge, bottomEdge, frontEdge); + positions[LBB] = new Vector3(leftEdge, bottomEdge, backEdge); + positions[LTF] = new Vector3(leftEdge, topEdge, frontEdge); + positions[LTB] = new Vector3(leftEdge, topEdge, backEdge); + positions[RBF] = new Vector3(rightEdge, bottomEdge, frontEdge); + positions[RBB] = new Vector3(rightEdge, bottomEdge, backEdge); + positions[RTF] = new Vector3(rightEdge, topEdge, frontEdge); + positions[RTB] = new Vector3(rightEdge, topEdge, backEdge); + } + public static void GetFacePositions(this Bounds bounds, Transform transform, ref Vector3[] positions) { const int numPoints = 6; @@ -338,13 +425,95 @@ public static void GetCornerAndMidPointPositions2D(this Bounds bounds, Transform positions[LB_LT] = Vector3.Lerp(positions[LB], positions[LT], 0.5f); } + /// + /// Method to get bounds from a collection of points. + /// + /// The points to construct a bounds around. + /// An AABB in world space around all the points. + /// True if bounds were calculated, if zero points are present bounds will not be calculated. + public static bool GetPointsBounds(List points, out Bounds bounds) + { + if (points.Count != 0) + { + bounds = new Bounds(points[0], Vector3.zero); + + for (var i = 1; i < points.Count; ++i) + { + bounds.Encapsulate(points[i]); + } + + return true; + } + + bounds = new Bounds(); + return false; + } + + /// + /// Method to get bounds using collider method. + /// + /// GameObject to generate the bounds around. + /// An AABB in world space around all the colliders in a gameObject hierarchy. + /// A LayerMask to restrict the colliders selected. + /// True if bounds were calculated, if zero colliders are present bounds will not be calculated. + public static bool GetColliderBounds(GameObject target, out Bounds bounds, LayerMask ignoreLayers) + { + var boundsPoints = new List(); + GetColliderBoundsPoints(target, boundsPoints, ignoreLayers); + + return GetPointsBounds(boundsPoints, out bounds); + } + + /// + /// Calculates how much scale is required for this Bounds to match another Bounds. + /// + /// Object representation to be scaled to + /// padding multiplied into another bounds + /// Scale represented as a Vector3 + public static Vector3 GetScaleToMatchBounds(this Bounds bounds, Bounds otherBounds, Vector3 padding = default(Vector3)) + { + Vector3 szA = otherBounds.size + new Vector3(otherBounds.size.x * padding.x, otherBounds.size.y * padding.y, otherBounds.size.z * padding.z); + Vector3 szB = bounds.size; + Assert.IsTrue(szB.x != 0 && szB.y != 0 && szB.z != 0, "The bounds of the object must not be zero."); + return new Vector3(szA.x / szB.x, szA.y / szB.y, szA.z / szB.z); + } + + /// + /// Calculates how much scale is required for this Bounds to fit inside another bounds without stretching. + /// + /// The bounds of the container we're trying to fit this object. + /// A single scale factor that can be applied to this object to fit inside the container. + public static float GetScaleToFitInside(this Bounds bounds, Bounds containerBounds) + { + var objectSize = bounds.size; + var containerSize = containerBounds.size; + Assert.IsTrue(objectSize.x != 0 && objectSize.y != 0 && objectSize.z != 0, "The bounds of the container must not be zero."); + return Mathf.Min(containerSize.x / objectSize.x, containerSize.y / objectSize.y, containerSize.z / objectSize.z); + } + /// /// Method to get bounding box points using Collider method. /// /// gameObject that boundingBox bounds. - /// array reference that gets filled with points. - /// layerMask to simplify search. - /// The colliders to use for calculating the bounds of this gameObject. + /// array reference that gets filled with points + /// layerMask to simplify search + /// compute bounds relative to this transform + public static void GetColliderBoundsPoints(GameObject target, List boundsPoints, LayerMask ignoreLayers, Transform relativeTo = null) + { + Collider[] colliders = target.GetComponentsInChildren(); + for (int i = 0; i < colliders.Length; i++) + { + GetColliderBoundsPoints(colliders[i], boundsPoints, ignoreLayers, relativeTo); + } + } + + /// + /// Method to get bounding box points using Collider method. + /// + /// gameObject that boundingBox bounds. + /// array reference that gets filled with points + /// layerMask to simplify search + /// The colliders to use for calculating the bounds of this gameObject public static void GetColliderBoundsPoints(GameObject target, ref List boundsPoints, LayerMask ignoreLayers, Collider[] colliders = null) { if (colliders == null) @@ -406,12 +575,71 @@ public static void GetColliderBoundsPoints(GameObject target, ref List } /// - /// GetRenderBoundsPoints gets bounding box points using Render method. + /// Method to get bounds from a single Collider /// - /// gameObject that bounding box bounds. - /// array reference that gets filled with points. - /// layerMask to simplify search. - /// The renderers to use for calculating the bounds of this gameObject. + /// Target collider + /// array reference that gets filled with points + /// layerMask to simplify search + public static void GetColliderBoundsPoints(Collider collider, List boundsPoints, LayerMask ignoreLayers, Transform relativeTo = null) + { + if (ignoreLayers == (1 << collider.gameObject.layer | ignoreLayers)) { return; } + + if (collider is SphereCollider) + { + SphereCollider sc = collider as SphereCollider; + Bounds sphereBounds = new Bounds(sc.center, 2 * sc.radius * Vector3.one); + sphereBounds.GetFacePositions(sc.transform, ref corners); + InverseTransformPoints(ref corners, relativeTo); + boundsPoints.AddRange(corners); + } + else if (collider is BoxCollider) + { + BoxCollider bc = collider as BoxCollider; + Bounds boxBounds = new Bounds(bc.center, bc.size); + boxBounds.GetCornerPositions(bc.transform, ref corners); + InverseTransformPoints(ref corners, relativeTo); + boundsPoints.AddRange(corners); + + } + else if (collider is MeshCollider) + { + MeshCollider mc = collider as MeshCollider; + Bounds meshBounds = mc.sharedMesh.bounds; + meshBounds.GetCornerPositions(mc.transform, ref corners); + InverseTransformPoints(ref corners, relativeTo); + boundsPoints.AddRange(corners); + } + else if (collider is CapsuleCollider) + { + CapsuleCollider cc = collider as CapsuleCollider; + Bounds capsuleBounds = new Bounds(cc.center, Vector3.zero); + switch (cc.direction) + { + case CAPSULE_X_AXIS: + capsuleBounds.size = new Vector3(cc.height, cc.radius * 2, cc.radius * 2); + break; + + case CAPSULE_Y_AXIS: + capsuleBounds.size = new Vector3(cc.radius * 2, cc.height, cc.radius * 2); + break; + + case CAPSULE_Z_AXIS: + capsuleBounds.size = new Vector3(cc.radius * 2, cc.radius * 2, cc.height); + break; + } + capsuleBounds.GetFacePositions(cc.transform, ref corners); + InverseTransformPoints(ref corners, relativeTo); + boundsPoints.AddRange(corners); + } + } + + /// + /// Method to get bounds from a single Collider + /// + /// gameObject that bounding box bounds + /// array reference that gets filled with points + /// layerMask to simplify search + /// The renderers to use for calculating the bounds of this gameObject public static void GetRenderBoundsPoints(GameObject target, ref List boundsPoints, LayerMask ignoreLayers, Renderer[] renderers = null) { if (renderers == null) @@ -623,32 +851,137 @@ public static bool CloserToPoint(this Bounds bounds, Vector3 point, Bounds other } /// - /// Returns the bounds of the model and all its contained meshes. + /// Draws a wire frame Bounds object using Debug.DrawLine. /// - /// The input bounding volume. - /// The target transform to inspect and calculate the bounds from. - /// Should the mesh query also include inactive components/objects. - /// Returns a object with the updated bounds (used to apply to the Size and Center points of a bounding volume) - public static Bounds CalculateBoundsForModel(this Bounds bounds, Transform transform, bool includeInactive = false) + /// The Bounds to draw. + /// Color of the line. + /// How long the line should be visible for in seconds. + /// Should the line be obscured by objects closer to the camera? + public static void DebugDraw(this Bounds bounds, Color color, float duration = 0.0f, bool depthTest = true) { - var renderers = transform.GetComponentsInChildren(includeInactive); + var center = bounds.center; + var x = bounds.extents.x; + var y = bounds.extents.y; + var z = bounds.extents.z; + var a = new Vector3(-x, y, -z); + var b = new Vector3(x, -y, -z); + var c = new Vector3(x, y, -z); + + var vertices = new Vector3[] + { + bounds.min, center + a, center + b, center + c, + bounds.max, center - a, center - b, center - c + }; - if (renderers.Length > 0) + for (var i = 0; i < boundsEdges.Length; i += 2) { - bounds = renderers[0].bounds; + Debug.DrawLine(vertices[boundsEdges[i]], vertices[boundsEdges[i + 1]], color, duration, depthTest); + } + } - for (int i = 1; i < renderers.Length; i++) + /// + /// Calculate the intersection area between the rectangle and another. + /// + // https://forum.unity.com/threads/getting-the-area-rect-of-intersection-between-two-rectangles.299140/ + public static bool Intersects(this Rect thisRect, Rect rect, out Rect area) + { + area = new Rect(); + + if (rect.Overlaps(thisRect)) + { + float x1 = Mathf.Min(thisRect.xMax, rect.xMax); + float x2 = Mathf.Max(thisRect.xMin, rect.xMin); + float y1 = Mathf.Min(thisRect.yMax, rect.yMax); + float y2 = Mathf.Max(thisRect.yMin, rect.yMin); + area.x = Mathf.Min(x1, x2); + area.y = Mathf.Min(y1, y2); + area.width = Mathf.Max(0.0f, x1 - x2); + area.height = Mathf.Max(0.0f, y1 - y2); + + return true; + } + + return false; + } + + /// + /// Compute Bounds, localized to , of all children of , excluding . + /// + /// + /// This is quite expensive, so call sparingly! This traverses the entire hierarchy and does quite a lot of work on each node. + /// + /// The root transform under which this method will traverse + calculate composite bounds. + /// The transform to exclude from the bounds calculation. Only valid if a direct child of . + /// Method to use to calculate bounds. + /// + /// Set to true if the bounds calculation finds a RectTransform. If true, it is recommended to re-run + /// this bounds calculation once more after a single frame delay, to make sure the computed layout sizing is taken into account. + /// + /// Should objects that are currently inactive be included in the bounds calculation? + /// Should we early-out if we find a canvas element? Will still set = true. + public static Bounds CalculateBounds(Transform root, Transform target, Transform exclude, out bool containsCanvas, + BoundsCalculationMethod boundsCalculationMethod = BoundsCalculationMethod.RendererOverCollider, + bool includeInactiveObjects = false, + bool abortOnCanvas = false) + { + totalBoundsCorners.Clear(); + childTransforms.Clear(); + containsCanvas = false; + + // Iterate transforms and collect bound volumes + foreach (Renderer childRenderer in target.GetComponentsInChildren(includeInactiveObjects)) + { + // Reject if child of exclude + if (exclude != null) { - bounds.Encapsulate(renderers[i].bounds); + if (childRenderer.transform.IsChildOf(exclude)) { continue; } } + + + containsCanvas |= childRenderer.transform is RectTransform; + if (containsCanvas && abortOnCanvas) { break; } + + ExtractBoundsCorners(childRenderer.transform, boundsCalculationMethod); + } + + if (totalBoundsCorners.Count == 0) + { + return new Bounds(); } - foreach (Transform child in transform) + Bounds finalBounds = new Bounds(root.InverseTransformPoint(totalBoundsCorners[0]), Vector3.zero); + + for (int i = 1; i < totalBoundsCorners.Count; i++) { - bounds.CalculateBoundsForModel(child); + finalBounds.Encapsulate(root.InverseTransformPoint(totalBoundsCorners[i])); } - return bounds; + return finalBounds; + } + + /// + /// Compute the flattening vector for a bounds of size . + /// + /// Returns a unit vector along the direction of the smallest component of . + /// + /// + /// Returns Vector3.forward if all components are approximately equal. + /// + /// The size of the bounds to compute the flatten vector for. + public static Vector3 CalculateFlattenVector(Vector3 size) + { + if (size.x < size.y && size.x < size.z) + { + return Vector3.right; + } + else if (size.y < size.x && size.y < size.z) + { + return Vector3.up; + } + else + { + return Vector3.forward; + } } #endregion @@ -663,6 +996,125 @@ private static Vector3 GetInvalidBoundsSize() return new Vector3(float.MaxValue, float.MaxValue, float.MaxValue); } + + /// + /// This enum defines what volume type the bound calculation depends on and its priority. + /// + public enum BoundsCalculationMethod + { + /// + /// Used Renderers for the bounds calculation and Colliders as a fallback + /// + RendererOverCollider = 0, + + /// + /// Used Colliders for the bounds calculation and Renderers as a fallback + /// + ColliderOverRenderer, + + /// + /// Omits Renderers and uses Colliders for the bounds calculation exclusively + /// + ColliderOnly, + + /// + /// Omits Colliders and uses Renderers for the bounds calculation exclusively + /// + RendererOnly, + } + + // Private scratchpad to reduce allocs. + private static List totalBoundsCorners = new List(8); + + // Private scratchpad to reduce allocs. + private static List childTransforms = new List(); + + // Private scratchpad to reduce allocs. + private static Vector3[] cornersToWorld = new Vector3[8]; + + private static void ExtractBoundsCorners(Transform childTransform, BoundsCalculationMethod boundsCalculationMethod) + { + KeyValuePair colliderByTransform = default; + KeyValuePair rendererBoundsByTransform = default; + + if (boundsCalculationMethod != BoundsCalculationMethod.RendererOnly) + { + Collider collider = childTransform.GetComponent(); + if (collider != null) + { + colliderByTransform = new KeyValuePair(childTransform, collider); + } + else + { + colliderByTransform = new KeyValuePair(); + } + } + + if (boundsCalculationMethod != BoundsCalculationMethod.ColliderOnly) + { + MeshFilter meshFilter = childTransform.GetComponent(); + if (meshFilter != null && meshFilter.sharedMesh != null) + { + rendererBoundsByTransform = new KeyValuePair(childTransform, meshFilter.sharedMesh.bounds); + } + else if (childTransform is RectTransform rt) + { + rendererBoundsByTransform = new KeyValuePair(childTransform, new Bounds(rt.rect.center, new Vector3(rt.rect.width, rt.rect.height, 0.1f))); + } + else + { + rendererBoundsByTransform = new KeyValuePair(); + } + } + + // Encapsulate the collider bounds if criteria match + if (boundsCalculationMethod == BoundsCalculationMethod.ColliderOnly || + boundsCalculationMethod == BoundsCalculationMethod.ColliderOverRenderer) + { + if (AddColliderBoundsCornersToTarget(colliderByTransform) && boundsCalculationMethod == BoundsCalculationMethod.ColliderOverRenderer || + boundsCalculationMethod == BoundsCalculationMethod.ColliderOnly) { return; } + } + + // Encapsulate the renderer bounds if criteria match + if (boundsCalculationMethod != BoundsCalculationMethod.ColliderOnly) + { + if (AddRendererBoundsCornersToTarget(rendererBoundsByTransform) && boundsCalculationMethod == BoundsCalculationMethod.RendererOverCollider || + boundsCalculationMethod == BoundsCalculationMethod.RendererOnly) { return; } + } + + // Do the collider for the one case that we chose RendererOverCollider and did not find a renderer + AddColliderBoundsCornersToTarget(colliderByTransform); + } + + private static bool AddRendererBoundsCornersToTarget(KeyValuePair rendererBoundsByTarget) + { + if (rendererBoundsByTarget.Key == null) { return false; } + + rendererBoundsByTarget.Value.GetCornerPositions(rendererBoundsByTarget.Key, ref cornersToWorld); + totalBoundsCorners.AddRange(cornersToWorld); + return true; + } + + private static bool AddColliderBoundsCornersToTarget(KeyValuePair colliderByTransform) + { + if (colliderByTransform.Key != null) + { + BoundsExtensions.GetColliderBoundsPoints(colliderByTransform.Value, totalBoundsCorners, 0); + } + + return colliderByTransform.Key != null; + } + + private static void InverseTransformPoints(ref Vector3[] positions, Transform relativeTo) + { + if (relativeTo) + { + for (var i = 0; i < positions.Length; ++i) + { + positions[i] = relativeTo.InverseTransformPoint(positions[i]); + } + } + } #endregion } } \ No newline at end of file diff --git a/Runtime/Extensions/BoundsExtensions.cs.meta b/Runtime/Extensions/BoundsExtensions.cs.meta index 2a44aa2..b9feb7f 100644 --- a/Runtime/Extensions/BoundsExtensions.cs.meta +++ b/Runtime/Extensions/BoundsExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/CameraExtensions.cs b/Runtime/Extensions/CameraExtensions.cs index 00bd3c9..7dee182 100644 --- a/Runtime/Extensions/CameraExtensions.cs +++ b/Runtime/Extensions/CameraExtensions.cs @@ -3,7 +3,7 @@ using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for the Unity's Camera class diff --git a/Runtime/Extensions/CameraExtensions.cs.meta b/Runtime/Extensions/CameraExtensions.cs.meta index c83b493..78fabd1 100644 --- a/Runtime/Extensions/CameraExtensions.cs.meta +++ b/Runtime/Extensions/CameraExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/CollectionsExtensions.cs b/Runtime/Extensions/CollectionsExtensions.cs index e8e57c6..a68e948 100644 --- a/Runtime/Extensions/CollectionsExtensions.cs +++ b/Runtime/Extensions/CollectionsExtensions.cs @@ -7,7 +7,7 @@ using System.Linq; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for .Net Collection objects, e.g. Lists, Dictionaries, Arrays @@ -143,7 +143,7 @@ public static bool EnsureListItem(this IList list, T item) return false; } - + /// /// Validate if a list contains items from another collection and adds items if not found, essentially merging the lists. /// @@ -170,7 +170,7 @@ public static void EnsureListItems(this IList list, IList items) { list.EnsureListItem(item); } - } + } /// /// Safely removes an item from a if it is found. diff --git a/Runtime/Extensions/CollectionsExtensions.cs.meta b/Runtime/Extensions/CollectionsExtensions.cs.meta index c840991..4acbd28 100644 --- a/Runtime/Extensions/CollectionsExtensions.cs.meta +++ b/Runtime/Extensions/CollectionsExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/ColliderExtensions.cs b/Runtime/Extensions/ColliderExtensions.cs index 54316d6..112f8c1 100644 --- a/Runtime/Extensions/ColliderExtensions.cs +++ b/Runtime/Extensions/ColliderExtensions.cs @@ -1,9 +1,9 @@ -// Copyright (c) Reality Collective. All rights reserved. +// Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's diff --git a/Runtime/Extensions/ColliderExtensions.cs.meta b/Runtime/Extensions/ColliderExtensions.cs.meta index 73e33be..b10daca 100644 --- a/Runtime/Extensions/ColliderExtensions.cs.meta +++ b/Runtime/Extensions/ColliderExtensions.cs.meta @@ -4,8 +4,6 @@ MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/CollisionExtensions.cs b/Runtime/Extensions/CollisionExtensions.cs index eef0562..bd64144 100644 --- a/Runtime/Extensions/CollisionExtensions.cs +++ b/Runtime/Extensions/CollisionExtensions.cs @@ -1,9 +1,9 @@ -// Copyright (c) Reality Collective. All rights reserved. +// Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { public static class CollisionExtensions { diff --git a/Runtime/Extensions/CollisionExtensions.cs.meta b/Runtime/Extensions/CollisionExtensions.cs.meta index f791853..791fa68 100644 --- a/Runtime/Extensions/CollisionExtensions.cs.meta +++ b/Runtime/Extensions/CollisionExtensions.cs.meta @@ -4,8 +4,6 @@ MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/Color32Extensions.cs b/Runtime/Extensions/Color32Extensions.cs index 556fe17..795e368 100644 --- a/Runtime/Extensions/Color32Extensions.cs +++ b/Runtime/Extensions/Color32Extensions.cs @@ -5,7 +5,7 @@ using System.Globalization; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's Color32 struct diff --git a/Runtime/Extensions/Color32Extensions.cs.meta b/Runtime/Extensions/Color32Extensions.cs.meta index ebde7c8..a2753a2 100644 --- a/Runtime/Extensions/Color32Extensions.cs.meta +++ b/Runtime/Extensions/Color32Extensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/ComparerExtensions.cs b/Runtime/Extensions/ComparerExtensions.cs index dfc1242..f72a93e 100644 --- a/Runtime/Extensions/ComparerExtensions.cs +++ b/Runtime/Extensions/ComparerExtensions.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for .Net Comparer diff --git a/Runtime/Extensions/ComparerExtensions.cs.meta b/Runtime/Extensions/ComparerExtensions.cs.meta index cdbe94b..043b2bf 100644 --- a/Runtime/Extensions/ComparerExtensions.cs.meta +++ b/Runtime/Extensions/ComparerExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/ComponentExtensions.cs b/Runtime/Extensions/ComponentExtensions.cs index 8f65184..cb53e6b 100644 --- a/Runtime/Extensions/ComponentExtensions.cs +++ b/Runtime/Extensions/ComponentExtensions.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extensions methods for the Unity Component class. diff --git a/Runtime/Extensions/ComponentExtensions.cs.meta b/Runtime/Extensions/ComponentExtensions.cs.meta index 5ab4462..c413135 100644 --- a/Runtime/Extensions/ComponentExtensions.cs.meta +++ b/Runtime/Extensions/ComponentExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/ConverterExtensions.cs b/Runtime/Extensions/ConverterExtensions.cs index 490c3c9..6dbd17f 100644 --- a/Runtime/Extensions/ConverterExtensions.cs +++ b/Runtime/Extensions/ConverterExtensions.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { public static class ConverterExtensions { diff --git a/Runtime/Extensions/ConverterExtensions.cs.meta b/Runtime/Extensions/ConverterExtensions.cs.meta index 0e9264a..6f7912d 100644 --- a/Runtime/Extensions/ConverterExtensions.cs.meta +++ b/Runtime/Extensions/ConverterExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/DoubleExtensions.cs b/Runtime/Extensions/DoubleExtensions.cs index 39f2e57..53c59f4 100644 --- a/Runtime/Extensions/DoubleExtensions.cs +++ b/Runtime/Extensions/DoubleExtensions.cs @@ -3,7 +3,7 @@ using System; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for the .Net Double struct diff --git a/Runtime/Extensions/DoubleExtensions.cs.meta b/Runtime/Extensions/DoubleExtensions.cs.meta index c8d7171..feb0b1e 100644 --- a/Runtime/Extensions/DoubleExtensions.cs.meta +++ b/Runtime/Extensions/DoubleExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/EnumExtensions.cs b/Runtime/Extensions/EnumExtensions.cs index 7124905..840944f 100644 --- a/Runtime/Extensions/EnumExtensions.cs +++ b/Runtime/Extensions/EnumExtensions.cs @@ -3,7 +3,7 @@ using System; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Casts an enum to an int using pointers. diff --git a/Runtime/Extensions/EnumExtensions.cs.meta b/Runtime/Extensions/EnumExtensions.cs.meta index 4b1ff4d..bb4c035 100644 --- a/Runtime/Extensions/EnumExtensions.cs.meta +++ b/Runtime/Extensions/EnumExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/EnumerableExtensions.cs b/Runtime/Extensions/EnumerableExtensions.cs index 2d3109c..722fafd 100644 --- a/Runtime/Extensions/EnumerableExtensions.cs +++ b/Runtime/Extensions/EnumerableExtensions.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for the .Net IEnumerable class diff --git a/Runtime/Extensions/EnumerableExtensions.cs.meta b/Runtime/Extensions/EnumerableExtensions.cs.meta index c97a50a..7642a0a 100644 --- a/Runtime/Extensions/EnumerableExtensions.cs.meta +++ b/Runtime/Extensions/EnumerableExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/FloatExtensions.cs b/Runtime/Extensions/FloatExtensions.cs index b703c46..8ba05d9 100644 --- a/Runtime/Extensions/FloatExtensions.cs +++ b/Runtime/Extensions/FloatExtensions.cs @@ -3,7 +3,7 @@ using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for the .Net Float struct diff --git a/Runtime/Extensions/FloatExtensions.cs.meta b/Runtime/Extensions/FloatExtensions.cs.meta index 20ecf2b..c559613 100644 --- a/Runtime/Extensions/FloatExtensions.cs.meta +++ b/Runtime/Extensions/FloatExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/GameObjectExtensions.cs b/Runtime/Extensions/GameObjectExtensions.cs index 7728a70..f714e87 100644 --- a/Runtime/Extensions/GameObjectExtensions.cs +++ b/Runtime/Extensions/GameObjectExtensions.cs @@ -7,7 +7,7 @@ using System.Runtime.CompilerServices; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's GameObject class @@ -245,5 +245,84 @@ public static void Validate(this GameObject gameobject, [CallerFilePath] string throw new MissingReferenceException($"{Path.GetFileNameWithoutExtension(callerName)} is missing a {typeof(GameObject).Name} reference for {fieldName}"); } } + + /// + /// Gets a on the or any of its children, if the is already attached to it. + /// + /// The type of the to lookup on the . + /// instance. + /// The instance found on + /// True if the Component was found on the GameObject or One of its children + /// Will only return the first instance if there are multiple in the GameObject Hierarchy + public static bool TryGetComponentInChildren(this GameObject gameObject, out T component) where T : Component + { + if (gameObject.TryGetComponent(out component)) + { + return true; + } + + foreach (Transform child in gameObject.transform) + { + if (child.gameObject.TryGetComponentInChildren(out component)) + { + return true; + } + } + + return false; + } + + /// + /// Gets an array of attached to the or any of its children, if the is already attached to it. + /// + /// The type of the to lookup on the . + /// instance. + /// The instance found on + /// True if the Component was found on the GameObject or One of its children + /// Will only return the first instance if there are multiple in the GameObject Hierarchy + public static bool TryGetComponentsInChildren(this GameObject gameobject, out T[] components) where T : Component + { + List componentsList = new List(); + if (gameobject.TryGetComponent(out var component)) + { + componentsList.Add(component); + } + + foreach (Transform child in gameobject.transform) + { + if (child.gameObject.TryGetComponentsInChildren(out var childComponents)) + { + componentsList.AddRange(childComponents); + } + } + + if(componentsList.Count > 0) + { + components = componentsList.ToArray(); + return true; + } + else + { + components = null; + return false; + } + } + + /// + /// Gets a on the , its parent or any of its children if it is already attached to it. + /// + /// The type of the to lookup on the . + /// instance. + /// The instance found on + /// True if the Component was found on the GameObject or One of its children + /// Will only return the first instance if there are multiple in the GameObject Hierarchy + public static bool TryGetComponentInChildrenAndParent(this GameObject input, out T component) where T : Component + { + if (input.transform.parent.IsNotNull() && input.transform.parent.gameObject.TryGetComponent(out component)) + { + return true; + } + return input.TryGetComponentInChildren(out component); + } } } diff --git a/Runtime/Extensions/GameObjectExtensions.cs.meta b/Runtime/Extensions/GameObjectExtensions.cs.meta index f11f4bf..f8656a5 100644 --- a/Runtime/Extensions/GameObjectExtensions.cs.meta +++ b/Runtime/Extensions/GameObjectExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/HandednessExtensions.cs b/Runtime/Extensions/HandednessExtensions.cs deleted file mode 100644 index f7e7c15..0000000 --- a/Runtime/Extensions/HandednessExtensions.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Reality Collective. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using RealityCollective.Definitions.Utilities; - -namespace RealityCollective.Extensions -{ - /// - /// type method extensions. - /// - public static class HandednessExtensions - { - /// - /// Gets the opposite "hand" flag for the current Handedness value. - /// - /// - /// If current = Left, returns Right. - /// If current = Right, returns Left. - /// Otherwise, returns None - /// - public static Handedness GetOppositeHandedness(this Handedness inputHandedness) - { - switch (inputHandedness) - { - case Handedness.Left: - return Handedness.Right; - case Handedness.Right: - return Handedness.Left; - default: - return Handedness.None; - } - } - - /// - /// Returns true if the current Handedness is the Right (i.e == Handedness.Right), false otherwise - /// - public static bool IsRight(this Handedness inputHandedness) - { - return inputHandedness == Handedness.Right; - } - - /// - /// Returns true if the current Handedness is the Right (i.e == Handedness.Right), false otherwise - /// - public static bool IsLeft(this Handedness inputHandedness) - { - return inputHandedness == Handedness.Left; - } - - /// - /// Returns true if the current Handedness is the Right (i.e == Handedness.Right), false otherwise - /// - public static bool IsNone(this Handedness inputHandedness) - { - return inputHandedness == Handedness.None; - } - - /// - /// Returns true if the current Handedness flags are a match with the comparison Handedness flags, false otherwise - /// - public static bool Equals(this Handedness inputHandedness, Handedness comparisonHandedness) - { - return (inputHandedness & comparisonHandedness) != 0; - } - } -} \ No newline at end of file diff --git a/Runtime/Extensions/HandednessExtensions.cs.meta b/Runtime/Extensions/HandednessExtensions.cs.meta deleted file mode 100644 index 0e095d6..0000000 --- a/Runtime/Extensions/HandednessExtensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d9b487d4b3b7bdf4d8041a5806da24ac -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/Extensions/LayerExtensions.cs b/Runtime/Extensions/LayerExtensions.cs index 19c3797..04b927b 100644 --- a/Runtime/Extensions/LayerExtensions.cs +++ b/Runtime/Extensions/LayerExtensions.cs @@ -3,7 +3,7 @@ using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's LayerMask struct diff --git a/Runtime/Extensions/LayerExtensions.cs.meta b/Runtime/Extensions/LayerExtensions.cs.meta index defd8f9..6641ab8 100644 --- a/Runtime/Extensions/LayerExtensions.cs.meta +++ b/Runtime/Extensions/LayerExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/MathfExtensions.cs b/Runtime/Extensions/MathfExtensions.cs index 8b36075..219123a 100644 --- a/Runtime/Extensions/MathfExtensions.cs +++ b/Runtime/Extensions/MathfExtensions.cs @@ -3,7 +3,7 @@ using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods and helper functions for various math data diff --git a/Runtime/Extensions/MathfExtensions.cs.meta b/Runtime/Extensions/MathfExtensions.cs.meta index 6268c6e..09c9657 100644 --- a/Runtime/Extensions/MathfExtensions.cs.meta +++ b/Runtime/Extensions/MathfExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/MatrixExtensions.cs b/Runtime/Extensions/MatrixExtensions.cs new file mode 100644 index 0000000..fcd5c5a --- /dev/null +++ b/Runtime/Extensions/MatrixExtensions.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace RealityCollective.Utilities.Extensions +{ + public static class MatrixExtensions + { + public static Quaternion ExtractRotation(this Matrix4x4 matrix) + { + Vector3 forward; + forward.x = matrix.m02; + forward.y = matrix.m12; + forward.z = matrix.m22; + + Vector3 upwards; + upwards.x = matrix.m01; + upwards.y = matrix.m11; + upwards.z = matrix.m21; + + return Quaternion.LookRotation(forward, upwards); + } + + public static Vector3 ExtractPosition(this Matrix4x4 matrix) + { + Vector3 position; + position.x = matrix.m03; + position.y = matrix.m13; + position.z = matrix.m23; + return position; + } + + public static Vector3 ExtractScale(this Matrix4x4 matrix) + { + Vector3 scale; + scale.x = new Vector4(matrix.m00, matrix.m10, matrix.m20, matrix.m30).magnitude; + scale.y = new Vector4(matrix.m01, matrix.m11, matrix.m21, matrix.m31).magnitude; + scale.z = new Vector4(matrix.m02, matrix.m12, matrix.m22, matrix.m32).magnitude; + return scale; + } + } +} \ No newline at end of file diff --git a/Runtime/Extensions/MatrixExtensions.cs.meta b/Runtime/Extensions/MatrixExtensions.cs.meta new file mode 100644 index 0000000..4af4fed --- /dev/null +++ b/Runtime/Extensions/MatrixExtensions.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 085e41bf0df44392972030afb1a27e28 +timeCreated: 1659630240 \ No newline at end of file diff --git a/Runtime/Extensions/ProcessExtensions.cs b/Runtime/Extensions/ProcessExtensions.cs index 272f29c..e498cfc 100644 --- a/Runtime/Extensions/ProcessExtensions.cs +++ b/Runtime/Extensions/ProcessExtensions.cs @@ -2,14 +2,14 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. #if UNITY_EDITOR || !UNITY_WSA +using RealityCollective.Utilities.Definitions; using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using RealityCollective.Definitions.Utilities; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension class. diff --git a/Runtime/Extensions/ProcessExtensions.cs.meta b/Runtime/Extensions/ProcessExtensions.cs.meta index 8ed286c..df12f75 100644 --- a/Runtime/Extensions/ProcessExtensions.cs.meta +++ b/Runtime/Extensions/ProcessExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/QuaternionExtensions.cs b/Runtime/Extensions/QuaternionExtensions.cs index c15ca90..b5c1e90 100644 --- a/Runtime/Extensions/QuaternionExtensions.cs +++ b/Runtime/Extensions/QuaternionExtensions.cs @@ -4,7 +4,7 @@ using System; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's Quaternion struct. diff --git a/Runtime/Extensions/QuaternionExtensions.cs.meta b/Runtime/Extensions/QuaternionExtensions.cs.meta index a6038c4..a781194 100644 --- a/Runtime/Extensions/QuaternionExtensions.cs.meta +++ b/Runtime/Extensions/QuaternionExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/RayExtensions.cs b/Runtime/Extensions/RayExtensions.cs index 906e20a..343abd5 100644 --- a/Runtime/Extensions/RayExtensions.cs +++ b/Runtime/Extensions/RayExtensions.cs @@ -3,7 +3,7 @@ using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's Ray struct diff --git a/Runtime/Extensions/RayExtensions.cs.meta b/Runtime/Extensions/RayExtensions.cs.meta index 76bf6f8..30ceb13 100644 --- a/Runtime/Extensions/RayExtensions.cs.meta +++ b/Runtime/Extensions/RayExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/SpriteExtensions.cs b/Runtime/Extensions/SpriteExtensions.cs index 0f5da4a..8f78230 100644 --- a/Runtime/Extensions/SpriteExtensions.cs +++ b/Runtime/Extensions/SpriteExtensions.cs @@ -3,7 +3,7 @@ using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's Sprite class diff --git a/Runtime/Extensions/SpriteExtensions.cs.meta b/Runtime/Extensions/SpriteExtensions.cs.meta index 0f3ebdb..c094074 100644 --- a/Runtime/Extensions/SpriteExtensions.cs.meta +++ b/Runtime/Extensions/SpriteExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/StringExtensions.cs b/Runtime/Extensions/StringExtensions.cs index 622e04a..5ee8262 100644 --- a/Runtime/Extensions/StringExtensions.cs +++ b/Runtime/Extensions/StringExtensions.cs @@ -7,7 +7,7 @@ using System.Text; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extensions. diff --git a/Runtime/Extensions/StringExtensions.cs.meta b/Runtime/Extensions/StringExtensions.cs.meta index e8da29c..3a1baa9 100644 --- a/Runtime/Extensions/StringExtensions.cs.meta +++ b/Runtime/Extensions/StringExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/SystemNumericsExtensions.cs b/Runtime/Extensions/SystemNumericsExtensions.cs index d50fcdb..5c1fab2 100644 --- a/Runtime/Extensions/SystemNumericsExtensions.cs +++ b/Runtime/Extensions/SystemNumericsExtensions.cs @@ -1,7 +1,7 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { public static class SystemNumericsExtensions { diff --git a/Runtime/Extensions/SystemNumericsExtensions.cs.meta b/Runtime/Extensions/SystemNumericsExtensions.cs.meta index a26b3f7..2e034e3 100644 --- a/Runtime/Extensions/SystemNumericsExtensions.cs.meta +++ b/Runtime/Extensions/SystemNumericsExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/TextureExtensions.cs b/Runtime/Extensions/TextureExtensions.cs index 655ec8f..e7a85da 100644 --- a/Runtime/Extensions/TextureExtensions.cs +++ b/Runtime/Extensions/TextureExtensions.cs @@ -1,11 +1,11 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using System.Threading.Tasks; using RealityCollective.Utilities.Async; +using System.Threading.Tasks; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// and Extensions. diff --git a/Runtime/Extensions/TextureExtensions.cs.meta b/Runtime/Extensions/TextureExtensions.cs.meta index 2fe8789..17eea7c 100644 --- a/Runtime/Extensions/TextureExtensions.cs.meta +++ b/Runtime/Extensions/TextureExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/TransformExtensions.cs b/Runtime/Extensions/TransformExtensions.cs index fe0eec4..416d550 100644 --- a/Runtime/Extensions/TransformExtensions.cs +++ b/Runtime/Extensions/TransformExtensions.cs @@ -6,7 +6,7 @@ using System.Text; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's Transform class diff --git a/Runtime/Extensions/TransformExtensions.cs.meta b/Runtime/Extensions/TransformExtensions.cs.meta index a076f3c..a6c9e64 100644 --- a/Runtime/Extensions/TransformExtensions.cs.meta +++ b/Runtime/Extensions/TransformExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/UnityObjectExtensions.cs b/Runtime/Extensions/UnityObjectExtensions.cs index 0639eb7..120a236 100644 --- a/Runtime/Extensions/UnityObjectExtensions.cs +++ b/Runtime/Extensions/UnityObjectExtensions.cs @@ -4,7 +4,7 @@ using UnityEngine; using Object = UnityEngine.Object; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's Object class diff --git a/Runtime/Extensions/UnityObjectExtensions.cs.meta b/Runtime/Extensions/UnityObjectExtensions.cs.meta index a7a1148..80035b9 100644 --- a/Runtime/Extensions/UnityObjectExtensions.cs.meta +++ b/Runtime/Extensions/UnityObjectExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Extensions/VectorExtensions.cs b/Runtime/Extensions/VectorExtensions.cs index 423498e..6ed0b37 100644 --- a/Runtime/Extensions/VectorExtensions.cs +++ b/Runtime/Extensions/VectorExtensions.cs @@ -5,7 +5,7 @@ using System.Linq; using UnityEngine; -namespace RealityCollective.Extensions +namespace RealityCollective.Utilities.Extensions { /// /// Extension methods for Unity's Vector struct diff --git a/Runtime/Extensions/VectorExtensions.cs.meta b/Runtime/Extensions/VectorExtensions.cs.meta index a0fe7f2..c663684 100644 --- a/Runtime/Extensions/VectorExtensions.cs.meta +++ b/Runtime/Extensions/VectorExtensions.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Utilities.meta b/Runtime/Logging.meta similarity index 100% rename from Runtime/Utilities.meta rename to Runtime/Logging.meta diff --git a/Runtime/Utilities/CaptureApplicationLog.cs b/Runtime/Logging/CaptureApplicationLog.cs similarity index 90% rename from Runtime/Utilities/CaptureApplicationLog.cs rename to Runtime/Logging/CaptureApplicationLog.cs index b05ea09..728dbfa 100644 --- a/Runtime/Utilities/CaptureApplicationLog.cs +++ b/Runtime/Logging/CaptureApplicationLog.cs @@ -1,10 +1,10 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using RealityCollective.Definitions.Utilities; +using RealityCollective.Utilities.Definitions; using UnityEngine; -namespace RealityCollective.Utilities +namespace RealityCollective.Utilities.Logging { /// /// Helper function to attach to a persistent gameobject in the loading scece, relays Unity events to the logging entity diff --git a/Runtime/Utilities/CaptureApplicationLog.cs.meta b/Runtime/Logging/CaptureApplicationLog.cs.meta similarity index 74% rename from Runtime/Utilities/CaptureApplicationLog.cs.meta rename to Runtime/Logging/CaptureApplicationLog.cs.meta index b07862a..10bee8f 100644 --- a/Runtime/Utilities/CaptureApplicationLog.cs.meta +++ b/Runtime/Logging/CaptureApplicationLog.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Definitions/Utilities/FilterLogType.cs b/Runtime/Logging/FilterLogType.cs similarity index 94% rename from Runtime/Definitions/Utilities/FilterLogType.cs rename to Runtime/Logging/FilterLogType.cs index 90e9919..104f7d4 100644 --- a/Runtime/Definitions/Utilities/FilterLogType.cs +++ b/Runtime/Logging/FilterLogType.cs @@ -1,7 +1,7 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -namespace RealityCollective.Definitions.Utilities +namespace RealityCollective.Utilities.Logging { public enum FilterLogType { diff --git a/Runtime/Definitions/Utilities/FilterLogType.cs.meta b/Runtime/Logging/FilterLogType.cs.meta similarity index 74% rename from Runtime/Definitions/Utilities/FilterLogType.cs.meta rename to Runtime/Logging/FilterLogType.cs.meta index c28ead3..71f0693 100644 --- a/Runtime/Definitions/Utilities/FilterLogType.cs.meta +++ b/Runtime/Logging/FilterLogType.cs.meta @@ -5,7 +5,6 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/Utilities/StaticLogger.cs b/Runtime/Logging/StaticLogger.cs similarity index 97% rename from Runtime/Utilities/StaticLogger.cs rename to Runtime/Logging/StaticLogger.cs index dff9da0..22f2cc3 100644 --- a/Runtime/Utilities/StaticLogger.cs +++ b/Runtime/Logging/StaticLogger.cs @@ -1,12 +1,12 @@ // Copyright (c) Reality Collective. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using RealityCollective.Definitions.Utilities; +using RealityCollective.Utilities.Definitions; using System; using System.Text; using UnityEngine; -namespace RealityCollective.Utilities +namespace RealityCollective.Utilities.Logging { /// /// Logging service to capture Log data and make it presentable, also includes helpers to upload logs to an external provider diff --git a/Runtime/Utilities/StaticLogger.cs.meta b/Runtime/Logging/StaticLogger.cs.meta similarity index 74% rename from Runtime/Utilities/StaticLogger.cs.meta rename to Runtime/Logging/StaticLogger.cs.meta index 6e45e27..9f57ac4 100644 --- a/Runtime/Utilities/StaticLogger.cs.meta +++ b/Runtime/Logging/StaticLogger.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Tests/AssemblyInfo.cs b/Tests/AssemblyInfo.cs index 3a92ae5..f741ab7 100644 --- a/Tests/AssemblyInfo.cs +++ b/Tests/AssemblyInfo.cs @@ -3,7 +3,7 @@ using System.Reflection; -[assembly: AssemblyVersion("1.0.10")] +[assembly: AssemblyVersion("1.0.11")] [assembly: AssemblyTitle("com.realitycollective.utilities.tests")] [assembly: AssemblyCompany("Reality Collective")] [assembly: AssemblyCopyright("Copyright (c) Reality Collective. All rights reserved.")] diff --git a/Tests/Extensions/ArrayExtensions.cs b/Tests/Extensions/ArrayExtensions.cs index 8b516c3..5d60130 100644 --- a/Tests/Extensions/ArrayExtensions.cs +++ b/Tests/Extensions/ArrayExtensions.cs @@ -1,5 +1,8 @@ +// Copyright (c) Reality Collective. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + using NUnit.Framework; -using RealityCollective.Extensions; +using RealityCollective.Utilities.Extensions; using UnityEngine; namespace RealityCollective.Utilities.Tests.Extensions diff --git a/Tests/Extensions/ArrayExtensions.cs.meta b/Tests/Extensions/ArrayExtensions.cs.meta index db2df05..9f7c8e0 100644 --- a/Tests/Extensions/ArrayExtensions.cs.meta +++ b/Tests/Extensions/ArrayExtensions.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/Tests/Extensions/EnumExtensionTests.cs b/Tests/Extensions/EnumExtensionTests.cs index 448927d..6e93ff3 100644 --- a/Tests/Extensions/EnumExtensionTests.cs +++ b/Tests/Extensions/EnumExtensionTests.cs @@ -2,7 +2,7 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. using NUnit.Framework; -using RealityCollective.Extensions; +using RealityCollective.Utilities.Extensions; using System; using System.Diagnostics; using Debug = UnityEngine.Debug; diff --git a/Tests/Extensions/EnumExtensionTests.cs.meta b/Tests/Extensions/EnumExtensionTests.cs.meta index 552acf4..48dab04 100644 --- a/Tests/Extensions/EnumExtensionTests.cs.meta +++ b/Tests/Extensions/EnumExtensionTests.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {fileID: 2800000, guid: 8ac5213854cf4dbabd140decf8df1946, type: 3} + icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: diff --git a/package.json b/package.json index 1ad6f00..79ce130 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,17 @@ { "name": "com.realitycollective.utilities", "displayName": "RealityCollective.Utilities", - "description": "A collection of useful utilities for Unity Projects by the Reality Collective.", + "description": "A collection of useful utilities for Unity projects by the Reality Collective.", + "version": "1.0.11-pre.4", + "documentationUrl": "https://realitycollective.io", + "changelogUrl": "https://github.com/realitycollective/com.realitytoolkit.utilities/releases", + "licensesUrl": "https://github.com/realitycollective/com.realitycollective.utilities/blob/main/LICENSE.md", "keywords": [ "Unity", - "Tools" + "Extensions", + "Tools", + "Utilities" ], - "version": "1.0.10-pre.2", "unity": "2020.3", "homepage": "https://realitycollective.io", "bugs": { @@ -22,6 +27,9 @@ "email": "realitycollectivedev@gmail.com", "url": "https://github.com/realitycollective" }, + "publishConfig": { + "registry": "https://package.openupm.com" + }, "dependencies": { "com.unity.modules.unitywebrequest": "1.0.0", "com.unity.editorcoroutines": "1.0.0",