ExtensionMethods Class |
Namespace: DustProductions.Core
public static class ExtensionMethods
The ExtensionMethods type exposes the following members.
| Name | Description | |
|---|---|---|
| AddNoDuplicatesT(ListT, ListT) |
Add only unique items to a list.
| |
| AddNoDuplicatesT(ListT, T) |
Add only unique items to a list.
| |
| AddNoDuplicatesT(ListT, T) |
Add only unique items to a list.
| |
| AnnounceComponentAdded |
Notifies any IComponentHandlers on the GameObject a Component is added to, that the Component has been added.
| |
| CheckIfGameObjectHasComponentOfTypeT |
Determines if a GameObject has at least one Component of a certain type already on it.
| |
| ContainsAnythingT |
Builds on IsNullOrEmpty() by also checking the items in the array itself to see if they are null.
| |
| Duplicate(GameObject, Boolean, Boolean) |
Creates a clone of a gameobject.
| |
| DuplicateT(T, Boolean, Boolean) |
Clones a generic type.
| |
| EnsureEnding |
A quick way to make sure a string ends with another string
| |
| IsApproximately |
Check to see if a float is close to another.
| |
| IsNullOrEmptyT(IEnumerableT) |
Extension method for checking if any enumerable is null or empty. Not as fast as the array check.
| |
| IsNullOrEmptyT(ListT) |
Extension method for quickly checking if a list is null or empty.
| |
| IsNullOrEmptyT(T) |
Extension method for quickly checking if an array is null or empty.
| |
| IsWithinRange |
Check to see if a float is within of the bounds passed in.
| |
| IsWithinRangeExclusive |
Check to see if a float is inside of the bounds passed in.
| |
| IsWithinRangeInclusive |
Check to see if a float is within of the bounds passed in.
| |
| Pause |
Pauses an array of AudioSources.
| |
| Play |
Plays an array of AudioSources.
| |
| PlayDelayed |
Plays an array of AudioSources after a delay.
| |
| PlayOneShot |
Plays an array of AudioSources one time (without looping).
| |
| PlayScheduled |
Plays an array of AudioSources at a certain time.
| |
| RoundToNearest(Int32, Int32) |
Rounds a number where you can specify the precision of the rounding
| |
| RoundToNearest(Single, Int32) |
Rounds a number where you can specify the precision of the rounding
| |
| RoundToNearest(Single, Single) |
Rounds a number where you can specify the precision of the rounding
| |
| SetActive |
Helper to set an array of GameObjects active or inactive
| |
| SetEnabled(ListBehaviour, Boolean) |
Helper to set a list of Behaviours active or inactive.
| |
| SetEnabled(Behaviour, Boolean) |
Helper to set an array of Behaviours active or inactive.
| |
| StartCoroutineT |
Use by calling this.StartCoroutine and assigning it to a Coroutine. Then you can call your assigned coroutine.Cancel(), or .HasFinished, or a variety of other neat things.
| |
| Stop |
Stops an array of AudioSources.
| |
| Trim |
Removes a string from the front and end of another string.
| |
| TrimEnd |
Removes a string from the end of another string.
| |
| TrimStart |
Removes a string from the beginning of another string.
| |
| TryAddAtFirstNullT |
Attempts to add an item to an array in the first spot it can find that's null.
| |
| TryAddComponentT |
Attempts to add a component to a GameObject. This can fail if there is already a component of some type on the GameObject, and only one is allowed.
| |
| TryGetComponentT(Component, T, Boolean) |
Attempts to get a component on a gameobject.
| |
| TryGetComponentT(GameObject, T, Boolean) |
Attempts to get a component on a gameobject.
| |
| TryGetComponentT1, T2(Component, T1, Boolean) |
Attempts to get a component on a gameobject.
| |
| TryGetComponentT1, T2(GameObject, T1, Boolean) |
Attempts to get a component on a gameobject.
| |
| TryGetComponentsT(Component, T, Boolean) |
Attempts to get components on a gameobject.
| |
| TryGetComponentsT(GameObject, T, Boolean) |
Attempts to get components on a GameObject.
| |
| TryGetComponentsT(GameObject, ListT, Boolean) |
Searches an array of GameObjects for a certain Type of Component. Can also add it if it doesn't exist.
| |
| TryGetComponentsT1, T2(Component, T1, Boolean) |
Attempts to get components on a gameobject.
| |
| TryGetComponentsT1, T2(GameObject, T1, Boolean) |
Attempts to get components on a GameObject.
| |
| TryGetComponentsT1, T2(GameObject, ListT1, Boolean) |
Searches an array of GameObjects for a certain Type of Component. Can also add it if it doesn't exist.
| |
| TryGetRootParentTypeT |
Attempts to get the uppermost type of an object in a GameObject tree.
| |
| TryRemoveItemsOfWrongTypeT1, T2(ListT1, Boolean) |
Removes the items in a list that don't match or inherit from the type specified. Will also remove null items.
| |
| TryRemoveItemsOfWrongTypeT1, T2(ListT1, ListT1, Boolean) |
Removes the items in a list that don't match or inherit from the type specified. Will also remove null items.
| |
| TryRemoveItemsOfWrongTypeT1, T2(T1, T1, Boolean) |
Removes the items in an array that don't match or inherit from the type specified. Will also remove null items.
| |
| TryRemoveItemsOfWrongTypeT1, T2(T1, T1, ListT1, Boolean) |
Removes the items in an array that don't match or inherit from the type specified. Will also remove null items.
| |
| TryRemoveNullItemsT |
Clean up null values inside of lists.
| |
| UnPause |
UnPauses an array of AudioSources.
|