public static Object GetAsObject(this Object unityObject, Type type)
        {
            if (type.IsAssignableFrom(unityObject.GetType()))
            {
                return(unityObject);
            }

            if (type == typeof(GameObject))
            {
                return(unityObject.GetAsGameObject());
            }

            if (typeof(Component).IsAssignableFrom(type))
            {
                return(unityObject.GetAsComponent(type));
            }

            return(null);
        }
        public static T GetAsObject <T>(this Object unityObject) where T : Object
        {
            if (unityObject is T t)
            {
                return(t);
            }

            if (typeof(T) == typeof(GameObject))
            {
                return(unityObject.GetAsGameObject() as T);
            }

            if (typeof(Component).IsAssignableFrom(typeof(T)))
            {
                return(unityObject.GetAsComponent <T>());
            }

            return(null);
        }