Exemplo n.º 1
0
        public static void OpenGallery(System.Action <Texture2D, ExifOrientation> callback, bool rotateImportedImage, Tastybits.NativeGallery.ImagePickerType iOSImagePickerType)
        {
            if (NativeGalleryController.Verbose)
            {
                Debug.Log("Opening Image Picker");
            }
            _callback = callback;

#if UNITY_IPHONE && !UNITY_EDITOR
            if (NativeGalleryController.Verbose)
            {
                Debug.Log("Opening Image Picker - iOS");
            }
            UIImagePicker.OpenPhotoAlbum((Texture2D texture, bool ok, string errMsg) => {
                _callback(texture, UIImagePicker.GetLastImportedOrientation());
            }, rotateImportedImage, iOSImagePickerType);
#elif UNITY_ANDROID && !UNITY_EDITOR
            if (NativeGalleryController.Verbose)
            {
                Debug.Log("Opening Image Picker - Android");
            }
            AndroidGallery.OpenGallery((Texture2D tex) => {
                _callback(tex, AndroidGallery.GetLastImportedOrientation());
            }, rotateImportedImage);
#elif UNITY_EDITOR
            if (NativeGalleryController.Verbose)
            {
                Debug.Log("Opening Image Picker - Editor");
            }
            NativeGalleryController.OpenEditorGallery(callback);
#else
            Debug.LogError("OpenGallery: Function not implemented for platform " + Application.platform);
#endif
        }
Exemplo n.º 2
0
        public static void OpenGallery(System.Action <Texture2D> callback)
        {
            _callback = callback;

#if UNITY_IPHONE && !UNITY_EDITOR
            UIImagePicker.OpenPhotoAlbum((Texture2D texture, bool ok, string errMsg) => {
                _callback(texture);
            });
#elif UNITY_ANDROID && !UNITY_EDITOR
            AndroidGallery.OpenGallery((Texture2D tex) => {
                _callback(tex);
            });
#elif UNITY_EDITOR
            NativeGalleryController.OpenEditorGallery(callback);
#else
            Debug.LogError("OpenGallery: Function not implemented for platform " + Application.platform);
#endif
        }