Search Results for

    Show / Hide Table of Contents

    Class UnityObjectExtensions

    Collection of extension methods that requires UnityEngine assembly reference.

    Inheritance
    object
    UnityObjectExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9
    Assembly: Glitch9.dll
    Syntax
    public static class UnityObjectExtensions

    Methods

    | Edit this page View Source

    EncodeToBase64(Object)

    Declaration
    public static string EncodeToBase64(this Object unityObject)
    Parameters
    Type Name Description
    Object unityObject
    Returns
    Type Description
    string
    | Edit this page View Source

    Find(GameObject, string)

    Declaration
    public static GameObject Find(this GameObject gameObject, string childName)
    Parameters
    Type Name Description
    GameObject gameObject
    string childName
    Returns
    Type Description
    GameObject
    | Edit this page View Source

    FindDeepChild(Transform, string, bool)

    Declaration
    public static Transform FindDeepChild(this Transform parent, string childName, bool includeInactive = false)
    Parameters
    Type Name Description
    Transform parent
    string childName
    bool includeInactive
    Returns
    Type Description
    Transform
    | Edit this page View Source

    FindGameObjectWithTagInChildren(Transform, string)

    Declaration
    public static GameObject FindGameObjectWithTagInChildren(this Transform parent, string tag)
    Parameters
    Type Name Description
    Transform parent
    string tag
    Returns
    Type Description
    GameObject
    | Edit this page View Source

    FindGameObjectsWithTagInChildren(Transform, string)

    Declaration
    public static GameObject[] FindGameObjectsWithTagInChildren(this Transform parent, string tag)
    Parameters
    Type Name Description
    Transform parent
    string tag
    Returns
    Type Description
    GameObject[]
    | Edit this page View Source

    Find<T>(T, string)

    Declaration
    public static Transform Find<T>(this T self, string childName) where T : Component
    Parameters
    Type Name Description
    T self
    string childName
    Returns
    Type Description
    Transform
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    Find<T, TTarget>(TTarget, T, string)

    Declaration
    public static T Find<T, TTarget>(this TTarget target, T defaultComponent, string chileName) where TTarget : Component
    Parameters
    Type Name Description
    TTarget target
    T defaultComponent
    string chileName
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    TTarget
    | Edit this page View Source

    Find<T, TTarget>(TTarget, T, string, string)

    Declaration
    public static T Find<T, TTarget>(this TTarget target, T defaultComponent, string chileName, string path) where TTarget : Component
    Parameters
    Type Name Description
    TTarget target
    T defaultComponent
    string chileName
    string path
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    TTarget
    | Edit this page View Source

    GetChildIndex<T>(T)

    Declaration
    public static int GetChildIndex<T>(this T obj) where T : Component
    Parameters
    Type Name Description
    T obj
    Returns
    Type Description
    int
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    GetComponentInChildrenWithName(Transform, Type, bool, params string[])

    Declaration
    public static Component GetComponentInChildrenWithName(this Transform parent, Type type, bool includeInactive, params string[] names)
    Parameters
    Type Name Description
    Transform parent
    Type type
    bool includeInactive
    string[] names
    Returns
    Type Description
    Component
    | Edit this page View Source

    GetComponentInChildrenWithName(Transform, Type, params string[])

    Declaration
    public static Component GetComponentInChildrenWithName(this Transform parent, Type type, params string[] names)
    Parameters
    Type Name Description
    Transform parent
    Type type
    string[] names
    Returns
    Type Description
    Component
    | Edit this page View Source

    GetComponentInChildrenWithName<T>(Transform, bool, params string[])

    Declaration
    public static T GetComponentInChildrenWithName<T>(this Transform parent, bool includeInactive, params string[] names) where T : Component
    Parameters
    Type Name Description
    Transform parent
    bool includeInactive
    string[] names
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    GetComponentInChildrenWithName<T>(Transform, params string[])

    Declaration
    public static T GetComponentInChildrenWithName<T>(this Transform parent, params string[] names) where T : Component
    Parameters
    Type Name Description
    Transform parent
    string[] names
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    GetOrAddComponentInChildren<T>(GameObject, string)

    Declaration
    public static T GetOrAddComponentInChildren<T>(this GameObject gameObject, string nameToSearch) where T : Component
    Parameters
    Type Name Description
    GameObject gameObject
    string nameToSearch
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    GetOrAddComponentInChildren<T>(RectTransform, string)

    Declaration
    public static T GetOrAddComponentInChildren<T>(this RectTransform rect, string childName = null) where T : Component
    Parameters
    Type Name Description
    RectTransform rect
    string childName
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    GetOrAddComponentInChildren<T, TV>(TV, string)

    Declaration
    public static T GetOrAddComponentInChildren<T, TV>(this TV obj, string childName = null) where T : Component where TV : Component
    Parameters
    Type Name Description
    TV obj
    string childName
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    TV
    | Edit this page View Source

    GetOrAddComponent<T>(GameObject)

    Declaration
    public static T GetOrAddComponent<T>(this GameObject obj) where T : Component
    Parameters
    Type Name Description
    GameObject obj
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    GetOrAddComponent<T>(Transform)

    Declaration
    public static T GetOrAddComponent<T>(this Transform obj) where T : Component
    Parameters
    Type Name Description
    Transform obj
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    GetOrAddGameObject(GameObject, string, string)

    Declaration
    public static GameObject GetOrAddGameObject(this GameObject parent, string objName, string secondName = null)
    Parameters
    Type Name Description
    GameObject parent
    string objName
    string secondName
    Returns
    Type Description
    GameObject
    | Edit this page View Source

    GetOrAddGameObjectInChildren(GameObject, string)

    Declaration
    public static GameObject GetOrAddGameObjectInChildren(this GameObject obj, string childName)
    Parameters
    Type Name Description
    GameObject obj
    string childName
    Returns
    Type Description
    GameObject
    | Edit this page View Source

    GetTexture2D(Material)

    Declaration
    public static Texture2D GetTexture2D(this Material material)
    Parameters
    Type Name Description
    Material material
    Returns
    Type Description
    Texture2D
    | Edit this page View Source

    GetTexture2D(Sprite)

    Declaration
    public static Texture2D GetTexture2D(this Sprite sprite)
    Parameters
    Type Name Description
    Sprite sprite
    Returns
    Type Description
    Texture2D
    | Edit this page View Source

    Or<T>(T, T)

    Declaration
    public static T Or<T>(T obj, T defaultObj) where T : Object
    Parameters
    Type Name Description
    T obj
    T defaultObj
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    SafeDestroyChild(GameObject, string)

    Declaration
    public static void SafeDestroyChild(this GameObject obj, string childName)
    Parameters
    Type Name Description
    GameObject obj
    string childName
    | Edit this page View Source

    SetAlpha(Color, float)

    Declaration
    public static Color SetAlpha(this Color color, float alpha)
    Parameters
    Type Name Description
    Color color
    float alpha
    Returns
    Type Description
    Color
    | Edit this page View Source

    SetDarkened(Color, float)

    Declaration
    public static Color SetDarkened(this Color color, float amount)
    Parameters
    Type Name Description
    Color color
    float amount
    Returns
    Type Description
    Color
    | Edit this page View Source

    SetInversed(Color)

    Declaration
    public static Color SetInversed(this Color color)
    Parameters
    Type Name Description
    Color color
    Returns
    Type Description
    Color
    | Edit this page View Source

    SetLightened(Color, float)

    Declaration
    public static Color SetLightened(this Color color, float amount)
    Parameters
    Type Name Description
    Color color
    float amount
    Returns
    Type Description
    Color
    | Edit this page View Source

    StringToVector2(string)

    Declaration
    public static Vector2 StringToVector2(this string vectorString)
    Parameters
    Type Name Description
    string vectorString
    Returns
    Type Description
    Vector2
    | Edit this page View Source

    StringToVector4(string)

    Declaration
    public static Vector4 StringToVector4(this string vectorString)
    Parameters
    Type Name Description
    string vectorString
    Returns
    Type Description
    Vector4
    | Edit this page View Source

    ToBytes(Object)

    Declaration
    public static byte[] ToBytes(this Object unityObject)
    Parameters
    Type Name Description
    Object unityObject
    Returns
    Type Description
    byte[]
    | Edit this page View Source

    ToColor(string, Color)

    Declaration
    public static Color ToColor(this string hex, Color defaultColor = default)
    Parameters
    Type Name Description
    string hex
    Color defaultColor
    Returns
    Type Description
    Color
    | Edit this page View Source

    ToHexColors(List<Color>)

    Declaration
    public static List<string> ToHexColors(this List<Color> colors)
    Parameters
    Type Name Description
    List<Color> colors
    Returns
    Type Description
    List<string>
    | Edit this page View Source

    ToHexString(Color)

    Declaration
    public static string ToHexString(this Color color)
    Parameters
    Type Name Description
    Color color
    Returns
    Type Description
    string
    | Edit this page View Source

    ToSprite(Texture2D)

    Declaration
    public static Sprite ToSprite(this Texture2D texture)
    Parameters
    Type Name Description
    Texture2D texture
    Returns
    Type Description
    Sprite
    | Edit this page View Source

    TryParseColor(string, out Color)

    Declaration
    public static bool TryParseColor(this string hex, out Color color)
    Parameters
    Type Name Description
    string hex
    Color color
    Returns
    Type Description
    bool
    | Edit this page View Source

    VectorToString(Vector2)

    Declaration
    public static string VectorToString(this Vector2 vector)
    Parameters
    Type Name Description
    Vector2 vector
    Returns
    Type Description
    string
    | Edit this page View Source

    VectorToString(Vector4)

    Declaration
    public static string VectorToString(this Vector4 vector)
    Parameters
    Type Name Description
    Vector4 vector
    Returns
    Type Description
    string
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation