Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Introducing Native Gallery Assist - (iOS/Android/Editor Emulator)

Discussion in 'Assets and Asset Store' started by crispybeans, May 10, 2016.

  1. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    Hi There

    We're happy to introduce the Native Gallery Assist - It's a plugin for iOS/Android which makes it possible to open the Photo Album/Gallery/Photos inside your game, select a photo and import to the Game as a texture.

    We tried to make it as easy to integrate the plugin as possible. The Plugin features a prefab to drag into an existing project as well as some Editor-Only UI for simulating a Gallery in the Unity Editor. Also the integration is a one-liner piece of code which is demonstrated int the demo scene.

    Assetstore Link:
    http://bitly.com/NativeGalleryAssist


    art_nativegallery.png
     
  2. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    We haven't gotten much response about this plugin for the people who has bought Native Gallery Assist. If you happen to stumble into some issue, please don't hesitate to write us and we will help you out.

    Also we take feature requests kindly so if you want anything to be done, just ask us.

    Someone asked if they could use it to take a photo with the Camera using UImagePicker, the short answer is, yes you can do that though it's not straight forward - There is a ImagePicker (iOS) class which can also open up the Native Camera app to take a snapshot. However this is not wrapped as a common interface since it's only implemented for iOS and not for android. Also, we advise people to check out our other plugin "Camera Capture Kit" if you want a complete solution for taking a photo with the Camera in Unity.

    Cheers
     
  3. orenfridman

    orenfridman

    Joined:
    Nov 25, 2015
    Posts:
    4
    Hi,
    Please explain how to change the script NativeGalleryDemo to accept Image/sprite and not RawImage?

    Thanks
     
  4. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    Hi Orenfridman

    Thank you for writing - It's a good question.

    When a texture is returned from the Gallery what you can do is to convert it to a sprite.

    Code (CSharp):
    1. var pivot = new Vector2(0.5f, 0.5f);
    2. var rect = Rect(0, 0, textureFromGallery.width, textureFromGallery.height);
    3. var spriteGrappedFromGallery = Sprite.Create(textureFromGallery, rect, pivot);
    4.  
     
  5. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    We have been getting questions if you can use the Native Gallery Assist SDK to open up the camera and take a photo. The short answer is yes, you can do that on iOS however the functionality is not yet available for Android - We did however make a more overall and Unity friendly solution for taking photos called Camera Capture Kit which is available on the assetstore : https://www.assetstore.unity3d.com/en/#!/content/56673
     
    Last edited: Jun 14, 2016
  6. jimprucey

    jimprucey

    Joined:
    Aug 12, 2012
    Posts:
    8
    Hi, Thank you, I got the demo working nice and built it on both Android and iOS devices. the issue that I am having is that when I try to pick an image that is 360 (flattened) from a Ricoh Theta camera I am getting just blue background. The file is really large. 5376 x 2688 any suggestions?
     
    crispybeans likes this.
  7. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    Could you please try and inspect the image format the image is saved in on the disk of the device ?
     
  8. jimprucey

    jimprucey

    Joined:
    Aug 12, 2012
    Posts:
    8
    .JPEG
     
  9. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    The plugin uses Unity's code for opening up a texture and it sounds like it's that bit failing , maybe since the texture is more than what is supported by the GPU as a texture. If you'd like I can maybe make a test for you where I try and resize the image with some native code to something more appropriate for the device ? For instance 2048 in width andt then a respective height. Would you be interested in that ?
     
    jimprucey likes this.
  10. tachyonix

    tachyonix

    Joined:
    Mar 15, 2012
    Posts:
    6
    Hi, I've sent you this by email but I didn't get a reply. I really need to make this work today.
    I'm testing the demo scene on a Galaxy S6 and when I press Open Gallery the screen turns to dark grey and nothing happens. Is there anything else I need to do?
    Also, I need to make the gallery show in a Gear VR app.
    Do you think your plug-in can help me with that?
    Thanks
     
  11. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    Hi Tackyonix

    Sorry I've missed your mail, good that you wrote here as well. I take it that you already bought the plugin and is experiencing a problem ? Did you try on other devices ? Which version of the Android OS is it running ? and lastly can you please see if you can send me some adb logcat info ?

    Cheers
     
  12. Requiem99

    Requiem99

    Joined:
    Aug 6, 2013
    Posts:
    12
    I have the same problem of tachyonix on my phone (Android 5.1) and with my tablet (Android 4.1.2). It doesn't work. I had send two mail but I didn't get a reply.
     
  13. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    Hi Requim99 - I've send you a private message.
     
    Requiem99 likes this.
  14. Requiem99

    Requiem99

    Joined:
    Aug 6, 2013
    Posts:
    12
    Thanks for the support! Now everything works well. If can help other users, the problem was my custom Android Manifest. Great asset and great support.
     
    gianmonje likes this.
  15. varnava

    varnava

    Joined:
    Mar 14, 2013
    Posts:
    6
    Hi. Dear support.
    Does your plugin support multiple photo picker? For example if i want to choose multiple photo from photo gallery on iOS devices
    Thanks a lot.
     
  16. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    Hi Vanava, The plugin currently supports picking one image, however we might be able to add and implement what you're after. Ive sent you a PM so we can have a discussion about it.
     
  17. varnava

    varnava

    Joined:
    Mar 14, 2013
    Posts:
    6
    Thanks a lot for your reply
     
  18. gianmonje

    gianmonje

    Joined:
    Dec 19, 2014
    Posts:
    2
    Thanks this helped me..
    I moved the Assets\Tastybits\NativeGallery\Manifest\AndroidManifest.xml to Plugins->Android folder for it to work
     
  19. gianmonje

    gianmonje

    Joined:
    Dec 19, 2014
    Posts:
    2
    Hi,
    While the gallery is open. How can i know if the user pressed cancel or back?
     
  20. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    @gianmonje Hi there! The SDK returns with a null texture in the callback when back/cancel is invoked.
     
  21. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    251
    Hi there,

    I'm really struggling to get the gallery to work on my devices. I have merged the manifest files are per the readme file, but when I run the demo all I get is a blank screen. Feeling frustrated :(

    Unity version 5.4 P1.

    I have also tried to use Unity's built in merging of manifest files, but that does the same.

    Thanks, Justin
     
  22. remik11

    remik11

    Joined:
    Aug 18, 2016
    Posts:
    1
    Hi Justin

    Please contact us on the support mail (tastbits8@gmail.com) and I will personally guide you through it step by step. We have also send a new update to the assetstore today which include a fix for a problem happening when you try and load very large images from the gallery.

    /Remi
     
  23. momo_the_monster

    momo_the_monster

    Joined:
    Sep 3, 2014
    Posts:
    16
    Hi there - after updating my project to Unity 5.5, the Native Gallery Assist plugin no longer works in my Android project. Using the demo scene, I log the following error after choosing an image:

    Exception: JNI: Init'd AndroidJavaObject with null ptr!

    Something strange - the call stack begins with Tastybits.NativeGallery.NativeIOSDelegate.CallDelegateFromNative, which seems to next call Tastybits.NativeGallery.AndroidGallery<OpenGallery>

    I've tried reimporting the plugin several times, as well as deleting all other Android plugins from my project. It does seem to work in Unity 5.5 in a brand-new project. Any ideas?
     
  24. myddt

    myddt

    Joined:
    May 13, 2015
    Posts:
    6
    My iphone is iOS 10, try your DEMO: Process all images will crash
     
  25. blamejane

    blamejane

    Joined:
    Jul 8, 2013
    Posts:
    233
    Love this plugin. I've successfully implemented a Messages.app style popup for opening the photo gallery as well as taking a photo using this asset (on iOS).

    The only thing I'd like to ask is anyone else see a delay when launching this asset? What I mean is, when user clicks the photo library button on the device, the following code called is:
    Code (CSharp):
    1.     // Photo Library option
    2.         // Open the device photo library
    3.         NativeGalleryController.OpenGallery (( Texture2D tex, ExifOrientation orientation) => {
    4.        ...
    5.  
    but the response time is lacking IMO. It's not bad, but enough that I came here looking for help to see if there's anything that can be done to make it more responsive?

    Thanks!
     
  26. tuanzi88

    tuanzi88

    Joined:
    Sep 10, 2015
    Posts:
    19
  27. Oksanny

    Oksanny

    Joined:
    Aug 29, 2015
    Posts:
    1
    Hello! I want to but plugin. I want to clarify. How do you give access to selected textures? Textures that are downloaded from the gallery have the same resolution?
     
  28. TreSisOn

    TreSisOn

    Joined:
    Mar 10, 2017
    Posts:
    1
    I would like help with NativeGallery, I'm currently able to take a photo and save it to my prefered destination:

    File.WriteAllBytes(myFolderLocation + "/" + screenShotName, screenshot.EncodeToPNG());

    Then after I have written to my Android phone, I want to update the Android gallery, which I try to do with this:

    Tastybits.NativeGallery.ImagePicker.OpenGallery((screenshot) => { Debug.Log("here is your texture : " + screenshot.name); });

    Here screenshot is a Texture2D, First time I open my App, and take a photo it shows in my Gallery, but when I try again by opening my App it won't show in my Gallery anymore :(

    Thanks in advanced!
     
  29. Pork-Roll-Lover

    Pork-Roll-Lover

    Joined:
    Sep 10, 2015
    Posts:
    3
    Hi,


    I just bought your asset from Unity Store and noticed that my game now requires a Camera permission in the Android Manifest. Is this permission require for NativeGallery? I only want to use it to select a picture file from the gallery but never want to use it to take a picture with the camera. Thanks
     
  30. virgilcwyile

    virgilcwyile

    Joined:
    Jan 31, 2016
    Posts:
    73
    Hey ,
    Is the multiple photo selection in IOS working with this plugin?