namespace Zinnia.Extension { using UnityEngine; /// /// Extended methods for the Type. /// public static class ComponentExtensions { /// /// Attempts to retrieve the from a given . /// /// The to retrieve the from. /// The if one exists on the given . public static Transform TryGetTransform(this Component component) { return (component == null ? null : component.transform); } /// /// Attempts to retrieve the from a given . /// /// The to retrieve the from. /// The if one exists on the given . public static GameObject TryGetGameObject(this Component component) { return (component == null ? null : component.gameObject); } } }