Added GameObjectExtensions. The following methods are in this class:
Exists - Checks if a UnityEngine object is not destroyed. This allows the usage of null-conditional and null-coalescing operators on Unity objects.
CopyComponent - Copies the values of the fields of a specified component to another component.
AddAndCopyComponent - Adds a new component, then copies the field values of another component into the new one.
EnsureAndCopyComponent - Ensures (get or add) a component with a specified type on the current game object, then copies the field values of the other component into it.
Added GeneralExtensions. The following methods are in this class:
Add - Adds an object to the end of an array.
TrimClone - Removes the "(Clone)" part from a string. This is useful for prefabbed game objects to get rid of multiple (Clone) upon instantiating.
Changes made in this pull request
Exists
- Checks if a UnityEngine object is not destroyed. This allows the usage of null-conditional and null-coalescing operators on Unity objects.CopyComponent
- Copies the values of the fields of a specified component to another component.AddAndCopyComponent
- Adds a new component, then copies the field values of another component into the new one.EnsureAndCopyComponent
- Ensures (get or add) a component with a specified type on the current game object, then copies the field values of the other component into it.Add
- Adds an object to the end of an array.TrimClone
- Removes the "(Clone)" part from a string. This is useful for prefabbed game objects to get rid of multiple (Clone) upon instantiating.