Hello I am currently writing an Android app that uses Unity to display a 3D model. The user is capable of interacting with the model as selecting objects in the scene. What I am having trouble is passing data back to the Android activity.
I currently have the Unity scene executing as a subview, can anyone point me in the direction on how to pass data from the scene to Android?
Do I have to create a Java plugin, explained here? link text
If this is the case, does anyone have any tutorials on this? The original material is kind of lacking. Thanks in advance.
For Unity to be able to export your game as an APK, you need to install the Android Build Support module on the Unity Editor that you are using to build your project. Under the Installs tab of Unity Hub, if you find the circled icon below your editor version, that means that Android Build Support is installed for it.
When Unity builds an Android app, it includes a . NET bytecode interpreter in native code, based on Mono. When you run the app, the interpreter is run to execute the bytecodes. That's how it can run on Android.
If you want to communicate from Unity to an Activity (Java code) you need to create a native plugin. Then in C# from Unity you can find the activity or the JavaObject and pass it parameters.
Check this out.
https://www.thepolyglotdeveloper.com/2014/06/creating-an-android-java-plugin-for-unity3d/
After you watch this page the summary would be:
Assets/Plugins/Android
folder.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With