Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using VoxelBusters.EssentialKit;
- public class MediaServicesCustom : MonoBehaviour
- {
- private Popup_OpenAppSettings permisionNotAuthorized;
- public void SelectImageFromGalleryWithUserPermision(Transform transform, Action<Texture2D> callbackTexture)
- {
- MediaServices.SelectImageFromGalleryWithUserPermision(canEdit: false, (textureData, error) =>
- {
- if (error == null)
- {
- //Debug.Log("Select image from gallery finished successfully.");
- callbackTexture.Invoke(textureData.GetTexture());
- }
- else
- {
- if (permisionNotAuthorized == null && error.Description == "Not authorized!")
- {
- //Debug.Log("Show Popup");
- permisionNotAuthorized = Globals.reference.GetStoragePrefabs().Instantiate_Popup_OpenAppSettings(transform);
- }
- //Debug.Log("Select image from gallery failed with error. Error: " + error);
- //Debug.Log("Code: " + error.Code + " Domain: " + error.Domain + " Descr: " + error.Description);
- callbackTexture.Invoke(null);
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment