{"_id":"5b1f8576c2505d0003125460","category":{"_id":"5b1f8576c2505d0003125431","version":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T17:01:47.129Z","from_sync":false,"order":14,"slug":"utilities","title":"Utilities"},"project":"571fa55ca0acd42000af9545","parentDoc":null,"user":"571fa519db52d01700f5cf3d","version":{"_id":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":4,"forked_from":"594949e52be16d0026ec04cd","createdAt":"2017-06-20T16:14:29.816Z","releaseDate":"2017-06-20T16:14:29.816Z","categories":["5b1f8576c2505d0003125424","5b1f8576c2505d0003125425","5b1f8576c2505d0003125426","5b1f8576c2505d0003125427","5b1f8576c2505d0003125428","5b1f8576c2505d0003125429","5b1f8576c2505d000312542a","5b1f8576c2505d000312542b","5b1f8576c2505d000312542c","5b1f8576c2505d000312542d","5b1f8576c2505d000312542e","5b1f8576c2505d000312542f","5b1f8576c2505d0003125430","5b1f8576c2505d0003125431","5b1f8576c2505d0003125432","5b1f8576c2505d0003125433","5b1f8576c2505d0003125434","5b1f8576c2505d0003125435","5b1f8576c2505d0003125436","5b1f8576c2505d0003125437","5b1f8576c2505d0003125438","5b1f8aab9c683000032979e7","5b1f8b2f3073470003ffa5da","5b1f8bd9fd653400031d94f4","5b1f900bd4c5f000036b57bd"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Mangalica","version_clean":"3.3.0","version":"3.3.0"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-01T17:02:32.886Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"## Overview\n\nThe Shared Methods script is a collection of reusable static methods that are used across a range of different scripts.\n\n## Class Methods\n\n### GetBounds/3\n\n  > `public static Bounds GetBounds(Transform transform, Transform excludeRotation = null, Transform excludeTransform = null)`\n\n * Parameters\n   * `Transform transform` -\n   * `Transform excludeRotation` - Resets the rotation of the transform temporarily to 0 to eliminate skewed bounds.\n   * `Transform excludeTransform` - Does not consider the stated object when calculating the bounds.\n * Returns\n   * `Bounds` - The bounds of the transform.\n\nThe GetBounds methods returns the bounds of the transform including all children in world space.\n\n### IsLowest/2\n\n  > `public static bool IsLowest(float value, float[] others)`\n\n * Parameters\n   * `float value` - The value to check to see if it is lowest.\n   * `float[] others` - The array of values to check against.\n * Returns\n   * `bool` - Returns true if the value is lower than all numbers in the given array, returns false if it is not the lowest.\n\nThe IsLowest method checks to see if the given value is the lowest number in the given array of values.\n\n### AddCameraFade/0\n\n  > `public static Transform AddCameraFade()`\n\n * Parameters\n   * _none_\n * Returns\n   * `Transform` - The transform of the headset camera.\n\nThe AddCameraFade method finds the headset camera and adds a headset fade script to it.\n\n### CreateColliders/1\n\n  > `public static void CreateColliders(GameObject obj)`\n\n * Parameters\n   * `GameObject obj` - The game object to attempt to add the colliders to.\n * Returns\n   * _none_\n\nThe CreateColliders method attempts to add box colliders to all child objects in the given object that have a renderer but no collider.\n\n### ColliderExclude/2\n\n  > `public static Collider[] ColliderExclude(Collider[] setA, Collider[] setB)`\n\n * Parameters\n   * `Collider[] setA` - The array that contains all of the relevant colliders.\n   * `Collider[] setB` - The array that contains the colliders to remove from setA.\n * Returns\n   * `Collider[]` - A Collider array that is a subset of setA that doesn't contain the colliders from setB.\n\nThe ColliderExclude method reduces the colliders in the setA array by those matched in the setB array.\n\n### GetCollidersInGameObjects/3\n\n  > `public static Collider[] GetCollidersInGameObjects(GameObject[] gameObjects, bool searchChildren, bool includeInactive)`\n\n * Parameters\n   * `GameObject[] gameObjects` - An array of GameObjects to get the colliders for.\n   * `bool searchChildren` - If this is `true` then the given GameObjects will also have their child GameObjects searched for colliders.\n   * `bool includeInactive` - If this is `true` then the inactive GameObjects in the array will also be checked for Colliders. Only relevant if `searchChildren` is `true`.\n * Returns\n   * `Collider[]` - An array of Colliders that are found in the given GameObject array.\n\nThe GetCollidersInGameObjects method iterates through a GameObject array and returns all of the unique found colliders for all GameObejcts.\n\n### CloneComponent/3\n\n  > `public static Component CloneComponent(Component source, GameObject destination, bool copyProperties = false)`\n\n * Parameters\n   * `Component source` - The component to copy.\n   * `GameObject destination` - The game object to copy the component to.\n   * `bool copyProperties` - Determines whether the properties of the component as well as the fields should be copied.\n * Returns\n   * `Component` - The component that has been cloned onto the given game object.\n\nThe CloneComponent method takes a source component and copies it to the given destination game object.\n\n### ColorDarken/2\n\n  > `public static Color ColorDarken(Color color, float percent)`\n\n * Parameters\n   * `Color color` - The source colour to apply the darken to.\n   * `float percent` - The percent to darken the colour by.\n * Returns\n   * `Color` - The new colour with the darken applied.\n\nThe ColorDarken method takes a given colour and darkens it by the given percentage.\n\n### RoundFloat/3\n\n  > `public static float RoundFloat(float givenFloat, int decimalPlaces, bool rawFidelity = false)`\n\n * Parameters\n   * `float givenFloat` - The float to round.\n   * `int decimalPlaces` - The number of decimal places to round to.\n   * `bool rawFidelity` - If this is true then the decimal places must be given in the decimal multiplier, e.g. 10 for 1dp, 100 for 2dp, etc.\n * Returns\n   * `float` - The rounded float.\n\nThe RoundFloat method is used to round a given float to the given decimal places.\n\n### IsEditTime/0\n\n  > `public static bool IsEditTime()`\n\n * Parameters\n   * _none_\n * Returns\n   * `bool` - Returns true if Unity is in the Unity Editor and not in play mode.\n\nThe IsEditTime method determines if the state of Unity is in the Unity Editor and the scene is not in play mode.\n\n### Mod/2\n\n  > `public static float Mod(float a, float b)`\n\n * Parameters\n   * `float a` - The dividend value.\n   * `float b` - The divisor value.\n * Returns\n   * `float` - The remainder value.\n\nThe Mod method is used to find the remainder of the sum a/b.\n\n### FindEvenInactiveGameObject<T>/2\n\n  > `public static GameObject FindEvenInactiveGameObject<T>(string gameObjectName = null, bool searchAllScenes = false) where T : Component`\n\n * Type Params\n   * `T` - The component type that needs to be on an ancestor of the wanted GameObject. Must be a subclass of `Component`.\n * Parameters\n   * `string gameObjectName` - The name of the wanted GameObject. If it contains a '/' character, this method traverses the hierarchy like a path name, beginning on the game object that has a component of type `T`.\n   * `bool searchAllScenes` - If this is true, all loaded scenes will be searched. If this is false, only the active scene will be searched.\n * Returns\n   * `GameObject` - The GameObject with name `gameObjectName` and an ancestor that has a `T`. If no such GameObject is found then `null` is returned.\n\nFinds the first GameObject with a given name and an ancestor that has a specific component. This method returns active as well as inactive GameObjects in all scenes. It doesn't return assets. For performance reasons it is recommended to not use this function every frame. Cache the result in a member variable at startup instead.\n\n### FindEvenInactiveComponents<T>/1\n\n  > `public static T[] FindEvenInactiveComponents<T>(bool searchAllScenes = false) where T : Component`\n\n * Type Params\n   * `T` - The component type to search for. Must be a subclass of `Component`.\n * Parameters\n   * `bool searchAllScenes` - If this is true, all loaded scenes will be searched. If this is false, only the active scene will be searched.\n * Returns\n   * `T[]` - All the found components. If no component is found an empty array is returned.\n\nFinds all components of a given type. This method returns components from active as well as inactive GameObjects in all scenes. It doesn't return assets. For performance reasons it is recommended to not use this function every frame. Cache the result in a member variable at startup instead.\n\n### FindEvenInactiveComponent<T>/1\n\n  > `public static T FindEvenInactiveComponent<T>(bool searchAllScenes = false) where T : Component`\n\n * Type Params\n   * `T` - The component type to search for. Must be a subclass of `Component`.\n * Parameters\n   * `bool searchAllScenes` - If this is true, all loaded scenes will be searched. If this is false, only the active scene will be searched.\n * Returns\n   * `T` - The found component. If no component is found `null` is returned.\n\nFinds the first component of a given type. This method returns components from active as well as inactive GameObjects in all scenes. It doesn't return assets. For performance reasons it is recommended to not use this function every frame. Cache the result in a member variable at startup instead.\n\n### GenerateVRTKObjectName/2\n\n  > `public static string GenerateVRTKObjectName(bool autoGen, params object[] replacements)`\n\n * Parameters\n   * `bool autoGen` - An additiona [AUTOGEN] prefix will be added if this is true.\n   * `params object[] replacements` - A collection of parameters to add to the generated name.\n * Returns\n   * `string` - The generated name string.\n\nThe GenerateVRTKObjectName method is used to create a standard name string for any VRTK generated object.\n\n### GetGPUTimeLastFrame/0\n\n  > `public static float GetGPUTimeLastFrame()`\n\n * Parameters\n   * _none_\n * Returns\n   * `float` - The total GPU time utilized last frame as measured by the VR subsystem.\n\nThe GetGPUTimeLastFrame retrieves the time spent by the GPU last frame, in seconds, as reported by the VR SDK.\n\n### Vector2ShallowCompare/3\n\n  > `public static bool Vector2ShallowCompare(Vector2 vectorA, Vector2 vectorB, int compareFidelity)`\n\n * Parameters\n   * `Vector2 vectorA` - The Vector2 to compare against.\n   * `Vector2 vectorB` - The Vector2 to compare with\n   * `int compareFidelity` - The number of decimal places to use when doing the comparison on the float elements within the Vector2.\n * Returns\n   * `bool` - Returns `true` if the given Vector2 objects match based on the given fidelity.\n\nThe Vector2ShallowCompare method compares two given Vector2 objects based on the given fidelity, which is the equivalent of comparing rounded Vector2 elements to determine if the Vector2 elements are equal.\n\n### Vector3ShallowCompare/3\n\n  > `public static bool Vector3ShallowCompare(Vector3 vectorA, Vector3 vectorB, float threshold)`\n\n * Parameters\n   * `Vector3 vectorA` - The Vector3 to compare against.\n   * `Vector3 vectorB` - The Vector3 to compare with\n   * `float threshold` - The distance in which the two Vector3 objects can be within to be considered true\n * Returns\n   * `bool` - Returns `true` if the given Vector3 objects are within the given threshold distance.\n\nThe Vector3ShallowCompare method compares two given Vector3 objects based on the given threshold, which is the equavelent of checking the distance between two Vector3 objects are above the threshold distance.\n\n### NumberPercent/2\n\n  > `public static float NumberPercent(float value, float percent)`\n\n * Parameters\n   * `float value` - The value to determine the percentage from\n   * `float percent` - The percentage to find within the given value.\n * Returns\n   * `float` - A float containing the percentage value based on the given input.\n\nThe NumberPercent method is used to determine the percentage of a given value.\n\n### SetGlobalScale/2\n\n  > `public static void SetGlobalScale(this Transform transform, Vector3 globalScale)`\n\n * Parameters\n   * `this Transform transform` - The reference to the transform to scale.\n   * `Vector3 globalScale` - A Vector3 of a global scale to apply to the given transform.\n * Returns\n   * _none_\n\nThe SetGlobalScale method is used to set a transform scale based on a global scale instead of a local scale.\n\n### VectorHeading/2\n\n  > `public static Vector3 VectorHeading(Vector3 originPosition, Vector3 targetPosition)`\n\n * Parameters\n   * `Vector3 originPosition` - The point to use as the originating position for the heading calculation.\n   * `Vector3 targetPosition` - The point to use as the target position for the heading calculation.\n * Returns\n   * `Vector3` - A Vector3 containing the heading changes of the target position in relation to the origin position.\n\nThe VectorHeading method calculates the current heading of the target position in relation to the origin position.\n\n### VectorDirection/2\n\n  > `public static Vector3 VectorDirection(Vector3 originPosition, Vector3 targetPosition)`\n\n * Parameters\n   * `Vector3 originPosition` - The point to use as the originating position for the direction calculation.\n   * `Vector3 targetPosition` - The point to use as the target position for the direction calculation.\n * Returns\n   * `Vector3` - A Vector3 containing the direction of the target position in relation to the origin position.\n\nThe VectorDirection method calculates the direction the target position is in relation to the origin position.\n\n### DividerToMultiplier/1\n\n  > `public static float DividerToMultiplier(float value)`\n\n * Parameters\n   * `float value` - The number to convert into the multplier value.\n * Returns\n   * `float` - The calculated number that can replace the divider number in a multiplication sum.\n\nThe DividerToMultiplier method takes a number to be used in a division and converts it to be used for multiplication. (e.g. 2 / 2 becomes 2 * 0.5)\n\n### NormalizeValue/4\n\n  > `public static float NormalizeValue(float value, float minValue, float maxValue, float threshold = 0f)`\n\n * Parameters\n   * `float value` - The actual value to normalize.\n   * `float minValue` - The minimum value the actual value can be.\n   * `float maxValue` - The maximum value the actual value can be.\n   * `float threshold` - The threshold to force to the minimum or maximum value if the normalized value is within the threhold limits.\n * Returns\n   * `float` -\n\nThe NormalizeValue method takes a given value between a specified range and returns the normalized value between 0f and 1f.\n\n### AxisDirection/2\n\n  > `public static Vector3 AxisDirection(int axisIndex, Transform givenTransform = null)`\n\n * Parameters\n   * `int axisIndex` - The axis index of the axis. `0 = x` `1 = y` `2 = z`\n   * `Transform givenTransform` - An optional Transform to get the Axis Direction for. If this is `null` then the World directions will be used.\n * Returns\n   * `Vector3` - The direction Vector3 based on the given axis index.\n\nThe AxisDirection method returns the relevant direction Vector3 based on the axis index in relation to x,y,z.\n\n### AddListValue<TValue>/3\n\n  > `public static bool AddListValue<TValue>(List<TValue> list, TValue value, bool preventDuplicates = false)`\n\n * Type Params\n   * `TValue` - The datatype for the list value.\n * Parameters\n   * `List<TValue> list` - The list to retrieve the value from.\n   * `TValue value` - The value to attempt to add to the list.\n   * `bool preventDuplicates` - If this is `false` then the value provided will always be appended to the list. If this is `true` the value provided will only be added to the list if it doesn't already exist.\n * Returns\n   * `bool` - Returns `true` if the given value was successfully added to the list. Returns `false` if the given value already existed in the list and `preventDuplicates` is `true`.\n\nThe AddListValue method adds the given value to the given list. If `preventDuplicates` is `true` then the given value will only be added if it doesn't already exist in the given list.\n\n### GetDictionaryValue<TKey, TValue>/4\n\n  > `public static TValue GetDictionaryValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue = default(TValue), bool setMissingKey = false)`\n\n * Type Params\n   * `TKey` - The datatype for the dictionary key.\n   * `TValue` - The datatype for the dictionary value.\n * Parameters\n   * `Dictionary<TKey, TValue> dictionary` - The dictionary to retrieve the value from.\n   * `TKey key` - The key to retrieve the value for.\n   * `TValue defaultValue` - The value to utilise when either setting the missing key (if `setMissingKey` is `true`) or the default value to return when no key is found (if `setMissingKey` is `false`).\n   * `bool setMissingKey` - If this is `true` and the given key is not present, then the dictionary value for the given key will be set to the `defaultValue` parameter. If this is `false` and the given key is not present then the `defaultValue` parameter will be returned as the value.\n * Returns\n   * `TValue` - The found value for the given key in the given dictionary, or the default value if no key is found.\n\nThe GetDictionaryValue method attempts to retrieve a value from a given dictionary for the given key. It removes the need for a double dictionary lookup to ensure the key is valid and has the option of also setting the missing key value to ensure the dictionary entry is valid.\n\n### GetDictionaryValue<TKey, TValue>/5\n\n  > `public static TValue GetDictionaryValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, out bool keyExists, TValue defaultValue = default(TValue), bool setMissingKey = false)`\n\n * Type Params\n   * `TKey` - The datatype for the dictionary key.\n   * `TValue` - The datatype for the dictionary value.\n * Parameters\n   * `Dictionary<TKey, TValue> dictionary` - The dictionary to retrieve the value from.\n   * `TKey key` - The key to retrieve the value for.\n   * `out bool keyExists` - Sets the given parameter to `true` if the key exists in the given dictionary or sets to `false` if the key didn't existing in the given dictionary.\n   * `TValue defaultValue` - The value to utilise when either setting the missing key (if `setMissingKey` is `true`) or the default value to return when no key is found (if `setMissingKey` is `false`).\n   * `bool setMissingKey` - If this is `true` and the given key is not present, then the dictionary value for the given key will be set to the `defaultValue` parameter. If this is `false` and the given key is not present then the `defaultValue` parameter will be returned as the value.\n * Returns\n   * `TValue` - The found value for the given key in the given dictionary, or the default value if no key is found.\n\nThe GetDictionaryValue method attempts to retrieve a value from a given dictionary for the given key. It removes the need for a double dictionary lookup to ensure the key is valid and has the option of also setting the missing key value to ensure the dictionary entry is valid.\n\n### AddDictionaryValue<TKey, TValue>/4\n\n  > `public static bool AddDictionaryValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value, bool overwriteExisting = false)`\n\n * Type Params\n   * `TKey` - The datatype for the dictionary key.\n   * `TValue` - The datatype for the dictionary value.\n * Parameters\n   * `Dictionary<TKey, TValue> dictionary` - The dictionary to set the value for.\n   * `TKey key` - The key to set the value for.\n   * `TValue value` - The value to set at the given key in the given dictionary.\n   * `bool overwriteExisting` - If this is `true` then the value for the given key will always be set to the provided value. If this is `false` then the value for the given key will only be set if the given key is not found in the given dictionary.\n * Returns\n   * `bool` - Returns `true` if the given value was successfully added to the dictionary at the given key. Returns `false` if the given key already existed in the dictionary and `overwriteExisting` is `false`.\n\nThe AddDictionaryValue method attempts to add a value for the given key in the given dictionary if the key does not already exist. If `overwriteExisting` is `true` then it always set the value even if they key exists.\n\n### GetTypeUnknownAssembly/1\n\n  > `public static Type GetTypeUnknownAssembly(string typeName)`\n\n * Parameters\n   * `string typeName` - The name of the type to get.\n * Returns\n   * `Type` - The Type, or null if none is found.\n\nThe GetTypeUnknownAssembly method is used to find a Type without knowing the exact assembly it is in.\n\n### GetEyeTextureResolutionScale/0\n\n  > `public static float GetEyeTextureResolutionScale()`\n\n * Parameters\n   * _none_\n * Returns\n   * `float` - Returns a float with the render scale for the resolution.\n\nThe GetEyeTextureResolutionScale method returns the render scale for the resolution.\n\n### SetEyeTextureResolutionScale/1\n\n  > `public static void SetEyeTextureResolutionScale(float value)`\n\n * Parameters\n   * `float value` - The value to set the render scale to.\n * Returns\n   * _none_\n\nThe SetEyeTextureResolutionScale method sets the render scale for the resolution.\n\n### IsTypeSubclassOf/2\n\n  > `public static bool IsTypeSubclassOf(Type givenType, Type givenBaseType)`\n\n * Parameters\n   * `Type givenType` - The Type to check.\n   * `Type givenBaseType` - The base Type to check.\n * Returns\n   * `bool` - Returns `true` if the given type is a subclass of the given base type.\n\nThe IsTypeSubclassOf checks if a given Type is a subclass of another given Type.\n\n### GetTypeCustomAttributes/3\n\n  > `public static object[] GetTypeCustomAttributes(Type givenType, Type attributeType, bool inherit)`\n\n * Parameters\n   * `Type givenType` - The type to get the custom attributes for.\n   * `Type attributeType` - The attribute type.\n   * `bool inherit` - Whether to inherit attributes.\n * Returns\n   * `object[]` - Returns an object array of custom attributes.\n\nThe GetTypeCustomAttributes method gets the custom attributes of a given type.\n\n### GetBaseType/1\n\n  > `public static Type GetBaseType(Type givenType)`\n\n * Parameters\n   * `Type givenType` - The type to return the base Type for.\n * Returns\n   * `Type` - Returns the base Type.\n\nThe GetBaseType method returns the base Type for the given Type.\n\n### IsTypeAssignableFrom/2\n\n  > `public static bool IsTypeAssignableFrom(Type givenType, Type sourceType)`\n\n * Parameters\n   * `Type givenType` - The Type to check on.\n   * `Type sourceType` - The Type to check if the given Type is assignable from.\n * Returns\n   * `bool` - Returns `true` if the given Type is assignable from the source Type.\n\nThe IsTypeAssignableFrom method determines if the given Type is assignable from the source Type.\n\n### GetNestedType/2\n\n  > `public static Type GetNestedType(Type givenType, string name)`\n\n * Parameters\n   * `Type givenType` - The Type to check on.\n   * `string name` - The name of the nested Type.\n * Returns\n   * `Type` - Returns the nested Type.\n\nThe GetNestedType method returns the nested Type of the given Type.\n\n### GetPropertyFirstName<T>/0\n\n  > `public static string GetPropertyFirstName<T>()`\n\n * Type Params\n   * `T` - The type to check the first property on.\n * Parameters\n   * _none_\n * Returns\n   * `string` - Returns a string representation of the first property name for the given Type.\n\nThe GetPropertyFirstName method returns the string name of the first property on a given Type.\n\n### GetCommandLineArguements/0\n\n  > `public static string[] GetCommandLineArguements()`\n\n * Parameters\n   * _none_\n * Returns\n   * `string[]` - Returns an array of command line arguements as strings.\n\nThe GetCommandLineArguements method returns the command line arguements for the environment.\n\n### GetTypesOfType/1\n\n  > `public static Type[] GetTypesOfType(Type givenType)`\n\n * Parameters\n   * `Type givenType` - The Type to check on.\n * Returns\n   * `Type[]` - An array of Types found.\n\nThe GetTypesOfType method returns an array of Types for the given Type.\n\n### GetExportedTypesOfType/1\n\n  > `public static Type[] GetExportedTypesOfType(Type givenType)`\n\n * Parameters\n   * `Type givenType` - The Type to check on.\n * Returns\n   * `Type[]` - An array of Exported Types found.\n\nThe GetExportedTypesOfType method returns an array of Exported Types for the given Type.\n\n### IsTypeAbstract/1\n\n  > `public static bool IsTypeAbstract(Type givenType)`\n\n * Parameters\n   * `Type givenType` - The Type to check on.\n * Returns\n   * `bool` - Returns `true` if the given type is abstract.\n\nThe IsTypeAbstract method determines if a given Type is abstract.","excerpt":"","slug":"vrtk_sharedmethods","type":"basic","title":"VRTK_SharedMethods"}

VRTK_SharedMethods


## Overview The Shared Methods script is a collection of reusable static methods that are used across a range of different scripts. ## Class Methods ### GetBounds/3 > `public static Bounds GetBounds(Transform transform, Transform excludeRotation = null, Transform excludeTransform = null)` * Parameters * `Transform transform` - * `Transform excludeRotation` - Resets the rotation of the transform temporarily to 0 to eliminate skewed bounds. * `Transform excludeTransform` - Does not consider the stated object when calculating the bounds. * Returns * `Bounds` - The bounds of the transform. The GetBounds methods returns the bounds of the transform including all children in world space. ### IsLowest/2 > `public static bool IsLowest(float value, float[] others)` * Parameters * `float value` - The value to check to see if it is lowest. * `float[] others` - The array of values to check against. * Returns * `bool` - Returns true if the value is lower than all numbers in the given array, returns false if it is not the lowest. The IsLowest method checks to see if the given value is the lowest number in the given array of values. ### AddCameraFade/0 > `public static Transform AddCameraFade()` * Parameters * _none_ * Returns * `Transform` - The transform of the headset camera. The AddCameraFade method finds the headset camera and adds a headset fade script to it. ### CreateColliders/1 > `public static void CreateColliders(GameObject obj)` * Parameters * `GameObject obj` - The game object to attempt to add the colliders to. * Returns * _none_ The CreateColliders method attempts to add box colliders to all child objects in the given object that have a renderer but no collider. ### ColliderExclude/2 > `public static Collider[] ColliderExclude(Collider[] setA, Collider[] setB)` * Parameters * `Collider[] setA` - The array that contains all of the relevant colliders. * `Collider[] setB` - The array that contains the colliders to remove from setA. * Returns * `Collider[]` - A Collider array that is a subset of setA that doesn't contain the colliders from setB. The ColliderExclude method reduces the colliders in the setA array by those matched in the setB array. ### GetCollidersInGameObjects/3 > `public static Collider[] GetCollidersInGameObjects(GameObject[] gameObjects, bool searchChildren, bool includeInactive)` * Parameters * `GameObject[] gameObjects` - An array of GameObjects to get the colliders for. * `bool searchChildren` - If this is `true` then the given GameObjects will also have their child GameObjects searched for colliders. * `bool includeInactive` - If this is `true` then the inactive GameObjects in the array will also be checked for Colliders. Only relevant if `searchChildren` is `true`. * Returns * `Collider[]` - An array of Colliders that are found in the given GameObject array. The GetCollidersInGameObjects method iterates through a GameObject array and returns all of the unique found colliders for all GameObejcts. ### CloneComponent/3 > `public static Component CloneComponent(Component source, GameObject destination, bool copyProperties = false)` * Parameters * `Component source` - The component to copy. * `GameObject destination` - The game object to copy the component to. * `bool copyProperties` - Determines whether the properties of the component as well as the fields should be copied. * Returns * `Component` - The component that has been cloned onto the given game object. The CloneComponent method takes a source component and copies it to the given destination game object. ### ColorDarken/2 > `public static Color ColorDarken(Color color, float percent)` * Parameters * `Color color` - The source colour to apply the darken to. * `float percent` - The percent to darken the colour by. * Returns * `Color` - The new colour with the darken applied. The ColorDarken method takes a given colour and darkens it by the given percentage. ### RoundFloat/3 > `public static float RoundFloat(float givenFloat, int decimalPlaces, bool rawFidelity = false)` * Parameters * `float givenFloat` - The float to round. * `int decimalPlaces` - The number of decimal places to round to. * `bool rawFidelity` - If this is true then the decimal places must be given in the decimal multiplier, e.g. 10 for 1dp, 100 for 2dp, etc. * Returns * `float` - The rounded float. The RoundFloat method is used to round a given float to the given decimal places. ### IsEditTime/0 > `public static bool IsEditTime()` * Parameters * _none_ * Returns * `bool` - Returns true if Unity is in the Unity Editor and not in play mode. The IsEditTime method determines if the state of Unity is in the Unity Editor and the scene is not in play mode. ### Mod/2 > `public static float Mod(float a, float b)` * Parameters * `float a` - The dividend value. * `float b` - The divisor value. * Returns * `float` - The remainder value. The Mod method is used to find the remainder of the sum a/b. ### FindEvenInactiveGameObject<T>/2 > `public static GameObject FindEvenInactiveGameObject<T>(string gameObjectName = null, bool searchAllScenes = false) where T : Component` * Type Params * `T` - The component type that needs to be on an ancestor of the wanted GameObject. Must be a subclass of `Component`. * Parameters * `string gameObjectName` - The name of the wanted GameObject. If it contains a '/' character, this method traverses the hierarchy like a path name, beginning on the game object that has a component of type `T`. * `bool searchAllScenes` - If this is true, all loaded scenes will be searched. If this is false, only the active scene will be searched. * Returns * `GameObject` - The GameObject with name `gameObjectName` and an ancestor that has a `T`. If no such GameObject is found then `null` is returned. Finds the first GameObject with a given name and an ancestor that has a specific component. This method returns active as well as inactive GameObjects in all scenes. It doesn't return assets. For performance reasons it is recommended to not use this function every frame. Cache the result in a member variable at startup instead. ### FindEvenInactiveComponents<T>/1 > `public static T[] FindEvenInactiveComponents<T>(bool searchAllScenes = false) where T : Component` * Type Params * `T` - The component type to search for. Must be a subclass of `Component`. * Parameters * `bool searchAllScenes` - If this is true, all loaded scenes will be searched. If this is false, only the active scene will be searched. * Returns * `T[]` - All the found components. If no component is found an empty array is returned. Finds all components of a given type. This method returns components from active as well as inactive GameObjects in all scenes. It doesn't return assets. For performance reasons it is recommended to not use this function every frame. Cache the result in a member variable at startup instead. ### FindEvenInactiveComponent<T>/1 > `public static T FindEvenInactiveComponent<T>(bool searchAllScenes = false) where T : Component` * Type Params * `T` - The component type to search for. Must be a subclass of `Component`. * Parameters * `bool searchAllScenes` - If this is true, all loaded scenes will be searched. If this is false, only the active scene will be searched. * Returns * `T` - The found component. If no component is found `null` is returned. Finds the first component of a given type. This method returns components from active as well as inactive GameObjects in all scenes. It doesn't return assets. For performance reasons it is recommended to not use this function every frame. Cache the result in a member variable at startup instead. ### GenerateVRTKObjectName/2 > `public static string GenerateVRTKObjectName(bool autoGen, params object[] replacements)` * Parameters * `bool autoGen` - An additiona [AUTOGEN] prefix will be added if this is true. * `params object[] replacements` - A collection of parameters to add to the generated name. * Returns * `string` - The generated name string. The GenerateVRTKObjectName method is used to create a standard name string for any VRTK generated object. ### GetGPUTimeLastFrame/0 > `public static float GetGPUTimeLastFrame()` * Parameters * _none_ * Returns * `float` - The total GPU time utilized last frame as measured by the VR subsystem. The GetGPUTimeLastFrame retrieves the time spent by the GPU last frame, in seconds, as reported by the VR SDK. ### Vector2ShallowCompare/3 > `public static bool Vector2ShallowCompare(Vector2 vectorA, Vector2 vectorB, int compareFidelity)` * Parameters * `Vector2 vectorA` - The Vector2 to compare against. * `Vector2 vectorB` - The Vector2 to compare with * `int compareFidelity` - The number of decimal places to use when doing the comparison on the float elements within the Vector2. * Returns * `bool` - Returns `true` if the given Vector2 objects match based on the given fidelity. The Vector2ShallowCompare method compares two given Vector2 objects based on the given fidelity, which is the equivalent of comparing rounded Vector2 elements to determine if the Vector2 elements are equal. ### Vector3ShallowCompare/3 > `public static bool Vector3ShallowCompare(Vector3 vectorA, Vector3 vectorB, float threshold)` * Parameters * `Vector3 vectorA` - The Vector3 to compare against. * `Vector3 vectorB` - The Vector3 to compare with * `float threshold` - The distance in which the two Vector3 objects can be within to be considered true * Returns * `bool` - Returns `true` if the given Vector3 objects are within the given threshold distance. The Vector3ShallowCompare method compares two given Vector3 objects based on the given threshold, which is the equavelent of checking the distance between two Vector3 objects are above the threshold distance. ### NumberPercent/2 > `public static float NumberPercent(float value, float percent)` * Parameters * `float value` - The value to determine the percentage from * `float percent` - The percentage to find within the given value. * Returns * `float` - A float containing the percentage value based on the given input. The NumberPercent method is used to determine the percentage of a given value. ### SetGlobalScale/2 > `public static void SetGlobalScale(this Transform transform, Vector3 globalScale)` * Parameters * `this Transform transform` - The reference to the transform to scale. * `Vector3 globalScale` - A Vector3 of a global scale to apply to the given transform. * Returns * _none_ The SetGlobalScale method is used to set a transform scale based on a global scale instead of a local scale. ### VectorHeading/2 > `public static Vector3 VectorHeading(Vector3 originPosition, Vector3 targetPosition)` * Parameters * `Vector3 originPosition` - The point to use as the originating position for the heading calculation. * `Vector3 targetPosition` - The point to use as the target position for the heading calculation. * Returns * `Vector3` - A Vector3 containing the heading changes of the target position in relation to the origin position. The VectorHeading method calculates the current heading of the target position in relation to the origin position. ### VectorDirection/2 > `public static Vector3 VectorDirection(Vector3 originPosition, Vector3 targetPosition)` * Parameters * `Vector3 originPosition` - The point to use as the originating position for the direction calculation. * `Vector3 targetPosition` - The point to use as the target position for the direction calculation. * Returns * `Vector3` - A Vector3 containing the direction of the target position in relation to the origin position. The VectorDirection method calculates the direction the target position is in relation to the origin position. ### DividerToMultiplier/1 > `public static float DividerToMultiplier(float value)` * Parameters * `float value` - The number to convert into the multplier value. * Returns * `float` - The calculated number that can replace the divider number in a multiplication sum. The DividerToMultiplier method takes a number to be used in a division and converts it to be used for multiplication. (e.g. 2 / 2 becomes 2 * 0.5) ### NormalizeValue/4 > `public static float NormalizeValue(float value, float minValue, float maxValue, float threshold = 0f)` * Parameters * `float value` - The actual value to normalize. * `float minValue` - The minimum value the actual value can be. * `float maxValue` - The maximum value the actual value can be. * `float threshold` - The threshold to force to the minimum or maximum value if the normalized value is within the threhold limits. * Returns * `float` - The NormalizeValue method takes a given value between a specified range and returns the normalized value between 0f and 1f. ### AxisDirection/2 > `public static Vector3 AxisDirection(int axisIndex, Transform givenTransform = null)` * Parameters * `int axisIndex` - The axis index of the axis. `0 = x` `1 = y` `2 = z` * `Transform givenTransform` - An optional Transform to get the Axis Direction for. If this is `null` then the World directions will be used. * Returns * `Vector3` - The direction Vector3 based on the given axis index. The AxisDirection method returns the relevant direction Vector3 based on the axis index in relation to x,y,z. ### AddListValue<TValue>/3 > `public static bool AddListValue<TValue>(List<TValue> list, TValue value, bool preventDuplicates = false)` * Type Params * `TValue` - The datatype for the list value. * Parameters * `List<TValue> list` - The list to retrieve the value from. * `TValue value` - The value to attempt to add to the list. * `bool preventDuplicates` - If this is `false` then the value provided will always be appended to the list. If this is `true` the value provided will only be added to the list if it doesn't already exist. * Returns * `bool` - Returns `true` if the given value was successfully added to the list. Returns `false` if the given value already existed in the list and `preventDuplicates` is `true`. The AddListValue method adds the given value to the given list. If `preventDuplicates` is `true` then the given value will only be added if it doesn't already exist in the given list. ### GetDictionaryValue<TKey, TValue>/4 > `public static TValue GetDictionaryValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue = default(TValue), bool setMissingKey = false)` * Type Params * `TKey` - The datatype for the dictionary key. * `TValue` - The datatype for the dictionary value. * Parameters * `Dictionary<TKey, TValue> dictionary` - The dictionary to retrieve the value from. * `TKey key` - The key to retrieve the value for. * `TValue defaultValue` - The value to utilise when either setting the missing key (if `setMissingKey` is `true`) or the default value to return when no key is found (if `setMissingKey` is `false`). * `bool setMissingKey` - If this is `true` and the given key is not present, then the dictionary value for the given key will be set to the `defaultValue` parameter. If this is `false` and the given key is not present then the `defaultValue` parameter will be returned as the value. * Returns * `TValue` - The found value for the given key in the given dictionary, or the default value if no key is found. The GetDictionaryValue method attempts to retrieve a value from a given dictionary for the given key. It removes the need for a double dictionary lookup to ensure the key is valid and has the option of also setting the missing key value to ensure the dictionary entry is valid. ### GetDictionaryValue<TKey, TValue>/5 > `public static TValue GetDictionaryValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, out bool keyExists, TValue defaultValue = default(TValue), bool setMissingKey = false)` * Type Params * `TKey` - The datatype for the dictionary key. * `TValue` - The datatype for the dictionary value. * Parameters * `Dictionary<TKey, TValue> dictionary` - The dictionary to retrieve the value from. * `TKey key` - The key to retrieve the value for. * `out bool keyExists` - Sets the given parameter to `true` if the key exists in the given dictionary or sets to `false` if the key didn't existing in the given dictionary. * `TValue defaultValue` - The value to utilise when either setting the missing key (if `setMissingKey` is `true`) or the default value to return when no key is found (if `setMissingKey` is `false`). * `bool setMissingKey` - If this is `true` and the given key is not present, then the dictionary value for the given key will be set to the `defaultValue` parameter. If this is `false` and the given key is not present then the `defaultValue` parameter will be returned as the value. * Returns * `TValue` - The found value for the given key in the given dictionary, or the default value if no key is found. The GetDictionaryValue method attempts to retrieve a value from a given dictionary for the given key. It removes the need for a double dictionary lookup to ensure the key is valid and has the option of also setting the missing key value to ensure the dictionary entry is valid. ### AddDictionaryValue<TKey, TValue>/4 > `public static bool AddDictionaryValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value, bool overwriteExisting = false)` * Type Params * `TKey` - The datatype for the dictionary key. * `TValue` - The datatype for the dictionary value. * Parameters * `Dictionary<TKey, TValue> dictionary` - The dictionary to set the value for. * `TKey key` - The key to set the value for. * `TValue value` - The value to set at the given key in the given dictionary. * `bool overwriteExisting` - If this is `true` then the value for the given key will always be set to the provided value. If this is `false` then the value for the given key will only be set if the given key is not found in the given dictionary. * Returns * `bool` - Returns `true` if the given value was successfully added to the dictionary at the given key. Returns `false` if the given key already existed in the dictionary and `overwriteExisting` is `false`. The AddDictionaryValue method attempts to add a value for the given key in the given dictionary if the key does not already exist. If `overwriteExisting` is `true` then it always set the value even if they key exists. ### GetTypeUnknownAssembly/1 > `public static Type GetTypeUnknownAssembly(string typeName)` * Parameters * `string typeName` - The name of the type to get. * Returns * `Type` - The Type, or null if none is found. The GetTypeUnknownAssembly method is used to find a Type without knowing the exact assembly it is in. ### GetEyeTextureResolutionScale/0 > `public static float GetEyeTextureResolutionScale()` * Parameters * _none_ * Returns * `float` - Returns a float with the render scale for the resolution. The GetEyeTextureResolutionScale method returns the render scale for the resolution. ### SetEyeTextureResolutionScale/1 > `public static void SetEyeTextureResolutionScale(float value)` * Parameters * `float value` - The value to set the render scale to. * Returns * _none_ The SetEyeTextureResolutionScale method sets the render scale for the resolution. ### IsTypeSubclassOf/2 > `public static bool IsTypeSubclassOf(Type givenType, Type givenBaseType)` * Parameters * `Type givenType` - The Type to check. * `Type givenBaseType` - The base Type to check. * Returns * `bool` - Returns `true` if the given type is a subclass of the given base type. The IsTypeSubclassOf checks if a given Type is a subclass of another given Type. ### GetTypeCustomAttributes/3 > `public static object[] GetTypeCustomAttributes(Type givenType, Type attributeType, bool inherit)` * Parameters * `Type givenType` - The type to get the custom attributes for. * `Type attributeType` - The attribute type. * `bool inherit` - Whether to inherit attributes. * Returns * `object[]` - Returns an object array of custom attributes. The GetTypeCustomAttributes method gets the custom attributes of a given type. ### GetBaseType/1 > `public static Type GetBaseType(Type givenType)` * Parameters * `Type givenType` - The type to return the base Type for. * Returns * `Type` - Returns the base Type. The GetBaseType method returns the base Type for the given Type. ### IsTypeAssignableFrom/2 > `public static bool IsTypeAssignableFrom(Type givenType, Type sourceType)` * Parameters * `Type givenType` - The Type to check on. * `Type sourceType` - The Type to check if the given Type is assignable from. * Returns * `bool` - Returns `true` if the given Type is assignable from the source Type. The IsTypeAssignableFrom method determines if the given Type is assignable from the source Type. ### GetNestedType/2 > `public static Type GetNestedType(Type givenType, string name)` * Parameters * `Type givenType` - The Type to check on. * `string name` - The name of the nested Type. * Returns * `Type` - Returns the nested Type. The GetNestedType method returns the nested Type of the given Type. ### GetPropertyFirstName<T>/0 > `public static string GetPropertyFirstName<T>()` * Type Params * `T` - The type to check the first property on. * Parameters * _none_ * Returns * `string` - Returns a string representation of the first property name for the given Type. The GetPropertyFirstName method returns the string name of the first property on a given Type. ### GetCommandLineArguements/0 > `public static string[] GetCommandLineArguements()` * Parameters * _none_ * Returns * `string[]` - Returns an array of command line arguements as strings. The GetCommandLineArguements method returns the command line arguements for the environment. ### GetTypesOfType/1 > `public static Type[] GetTypesOfType(Type givenType)` * Parameters * `Type givenType` - The Type to check on. * Returns * `Type[]` - An array of Types found. The GetTypesOfType method returns an array of Types for the given Type. ### GetExportedTypesOfType/1 > `public static Type[] GetExportedTypesOfType(Type givenType)` * Parameters * `Type givenType` - The Type to check on. * Returns * `Type[]` - An array of Exported Types found. The GetExportedTypesOfType method returns an array of Exported Types for the given Type. ### IsTypeAbstract/1 > `public static bool IsTypeAbstract(Type givenType)` * Parameters * `Type givenType` - The Type to check on. * Returns * `bool` - Returns `true` if the given type is abstract. The IsTypeAbstract method determines if a given Type is abstract.