Class Extensions_UnityObject
Inheritance
Extensions_UnityObject
Assembly: fwt.core.dll
Syntax
public static class Extensions_UnityObject
Methods
Loops through children of given tranform and searches requested Component.
Found results is collected into components list.
Provided components list is Cleared before usage.
If provided components list is null, creates new list.
returns null if there is no transform;
Declaration
public static List<TComponent> GetComponentsInChildrenPreserveOrder<TComponent>(this Transform transform, List<TComponent> components = null) where TComponent : MonoBehaviour
Parameters
| Type |
Name |
Description |
| Transform |
transform |
|
| List<TComponent> |
components |
|
Returns
| Type |
Description |
| List<TComponent> |
|
Type Parameters
| Name |
Description |
| TComponent |
|
Returns the root canvas of the whole hierarchy of the given transform.
Declaration
public static Canvas GetRootCanvas(this Transform transform)
Parameters
| Type |
Name |
Description |
| Transform |
transform |
|
Returns
SmartDestroy(object)
Declaration
public static void SmartDestroy(this object instance)
Parameters
| Type |
Name |
Description |
| object |
instance |
|
SmartDestroy<TObject>(TObject)
Destroys given object instance or it's GameObject (if it's MonoBehaviour).
If Apllication is Playing (Play mode), calls Object.Destroy();
If Application is in Editor (Editor mode), calls Object.DestroyImmediate();
Checks given object to null.
Declaration
public static void SmartDestroy<TObject>(this TObject instance) where TObject : Object
Parameters
| Type |
Name |
Description |
| TObject |
instance |
|
Type Parameters
SmartDisableGameObject<TObject>(TObject)
Declaration
public static void SmartDisableGameObject<TObject>(this TObject instance) where TObject : Object
Parameters
| Type |
Name |
Description |
| TObject |
instance |
|
Type Parameters
SmartEnableGameObject<TObject>(TObject)
Declaration
public static void SmartEnableGameObject<TObject>(this TObject instance) where TObject : Object
Parameters
| Type |
Name |
Description |
| TObject |
instance |
|
Type Parameters
SmartGetComponent<TComponent>(object)
If instance is TComponent, returns it as TComponent;
If instance is GameObject or MonoBehaviour, calls GetComponentTComponent() at that GameObject
Declaration
public static TComponent SmartGetComponent<TComponent>(this object instance)
Parameters
| Type |
Name |
Description |
| object |
instance |
|
Returns
| Type |
Description |
| TComponent |
|
Type Parameters
| Name |
Description |
| TComponent |
|
SmartGetGameGameObject(object)
if instance is GameObject, returns it as GameObject;
if instance is MonoBehaviour, returns it's GameObject
Declaration
public static GameObject SmartGetGameGameObject(this object instance)
Parameters
| Type |
Name |
Description |
| object |
instance |
|
Returns
| Type |
Description |
| GameObject |
|