- Home /
Draw using android openGL?
Hi, I am very new to unity and maybe my question is too silly. I would like to load images from my android java code on Unity textures? is that even possible? and if yes How? (I am using unity 4.2)
Update:
My final goal is to have the logic for finding/loading the image in the android code and just use the unity to provide the 3D environment. Basically use android opengl to load the image.
off the top of my head this is what I want to do: 1- create a plane in unity. 2- generate a texture for the plane and pass the texture or id of the texture to my .jar plugin. 2- in my .jar file there is a method that loads an image on to a texture. 3- send the texture to unity or tell unity to update the texture.
I think you can call native code with the PRO version only (and need Android PRO also), if that is what you mean. If you just want to move images from an existing java project to Unity, please clarify, that should be easy (just copy files to Assets folder).
Answer by shopguy · Mar 14, 2014 at 10:32 PM
If I understand the question I might be able to provide a better answer, but I think this is what you are looking for:
http://docs.unity3d.com/Documentation/Manual/Plugins.html
and Android specific:
http://docs.unity3d.com/Documentation/Manual/PluginsForAndroid.html
Basically, you need to compile your java project to a library and include in your Unity project, then follow the rest of the steps to call in to it.
Read your update. As I don't have Unity Pro I really don't know much about details of calling native code. Once you figure that out, if you aren't able to pass actual images/texture/game-objects back and forth, you might be able to kludge something using files. http://answers.unity3d.com/questions/30147/loading-images-textures-resourcesload-vs-wwwtextur.html gives some ways to load images from file.