Hello, sorry for my bad English, so I decided to use google trantslate. The Russian community did not find people who are well able to bind Adnroid SDK + Unity3d. Therefore, I ask you to help. I need to open for the event buttonClick Android gallery and select from there the image is uploaded to the application. Write a guide so you do not want and use the gallery - this is the best option. Please help with code foreign comrades) Thank you very much, and write on the "simple" English))
We're not here to do work for you lol. You can just wirte a Gallery activity in Eclipse and make a method to send an intents (Activities and most other stuff is handled via Intents, some kind of message broadcasting). Sending an intent is easy, it's someting like that (in Java) Code (csharp): public void shareThis() { Intent galleryIntent = new Intent(this, MyGalleryActivity.class); startActivity(shareIntent); } Call this via JNI from Android. Once a user has selected an image, send the image's path to unity via (java code agan) Code (csharp): UnityPlayer.UnitySendMessage("ObjectNameInUnity", "MethodNameInUnity", "/path/to/the/image.png"); In C# you should have a GameObject which contains a script like th is: Code (csharp): public class ObjectNameInUnity : MonoBehaviour { void MethodNameInUnity(string path) { // load the image from that path and do something with it } }
Actually not. I've never seen a game that used it, so it can't be really that broad. You just have to do the steps above, it isn't that hard. Of couse you need some basic knowledge of Android and Android development, otherwise it's quite pointless to make Apps for that platform
Just makes sense that I need a photo on your avatar. And I just do not see any other option but to write a guide or use the gallery
http://www.androidsnippets.com/get-file-path-of-gallery-image Here's a quick example on how to use the built-in gallery to select an image and return it's path. 60 seconds worth of googeling and then just send the resulting path to unity. If you are unable to use this info buts to implement it, then you probably shouldn't be an developer anyways. You can't expect to copy and paste or follow tutorials for everything and expect to get a Game or App done. You must learn to understand it and implement it yourself, without someone holding on your hand and leading your through each step.
I try http://www.androidsnippets.com/get-file-path-of-gallery-image but the method startActivityForResult never get called, Any idea?
Browse image,video and contact in Android https://www.assetstore.unity3d.com/en/#!/content/28597 Open gallery or another android app from unity http://u3d.as/content/devesh-pandey/app-launcher/8KH
Thanks, DeveshPandey! Your plugin worked great on Unity 5 for selecting images from the Android gallery.
Adding to this, here is our plugin which support picking image from gallery along with other more features. Cross Platform Native Plugins | Tutorial for Media Library feature
I think the problem with this method is it won't play well with any other plugin that also uses com.unity3d.player.UnityPlayer class. This is my problem right now. I use Facebook and Firebase plugins that are interfering with the plugin I'm trying to make. Really stuck on this issue at the moment...
hello, i am unable to load images from a android mobile gallery into my unity application. if anyone done this can you please help me..!!