Guest User

Untitled

a guest
Jun 26th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using VoxelBusters.EssentialKit;
  6.  
  7. public class MediaServicesCustom : MonoBehaviour
  8. {
  9. private Popup_OpenAppSettings permisionNotAuthorized;
  10.  
  11. public void SelectImageFromGalleryWithUserPermision(Transform transform, Action<Texture2D> callbackTexture)
  12. {
  13. MediaServices.SelectImageFromGalleryWithUserPermision(canEdit: false, (textureData, error) =>
  14. {
  15. if (error == null)
  16. {
  17. //Debug.Log("Select image from gallery finished successfully.");
  18. callbackTexture.Invoke(textureData.GetTexture());
  19. }
  20. else
  21. {
  22. if (permisionNotAuthorized == null && error.Description == "Not authorized!")
  23. {
  24. //Debug.Log("Show Popup");
  25. permisionNotAuthorized = Globals.reference.GetStoragePrefabs().Instantiate_Popup_OpenAppSettings(transform);
  26. }
  27.  
  28. //Debug.Log("Select image from gallery failed with error. Error: " + error);
  29. //Debug.Log("Code: " + error.Code + " Domain: " + error.Domain + " Descr: " + error.Description);
  30. callbackTexture.Invoke(null);
  31. }
  32. });
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment