Have created a Augment Reality app using Vuforia which would play video on recognition. Now, just need the ability to show 3D objects as well. I did follow the video tutorial from Vuforia on this and able to get the 3D models showing on targets using Unity engine. But, when I exported the project as android (eclipse) project I could locate only 3 activity classes. The challenge here is how to integrate these two projects together.
The component that loads 3D model using unity player is abstracted and not exposed. I was thinking I could just simply use the unity player API to load the 3D models within my existing project.
Is there a way the 3D model loading code be exposed to the Java (android) part? As I need to dynamically load the models and might need to download it from the server and load it.
Since we have done so much work on the UI part of our existing application it will be really helpful if we can just plug the Unity player and manage the model inside our app.
Thanks in advance.
You may find some tips here : https://developer.vuforia.com/forum/faq/unity-how-can-i-extend-unitys-android-activity
It was helpfull to me to override QCARPlayerActivity class, and it seems to work fine (actually, i'm stuck with another problem to finish() the activity...)
Related
I have been making a game for a while in Android Studio, using just plain Android features like Drawable-s and such for the visuals.
I am planning to add change/update some things and I think that would be easier to do with Godot, but I want to keep the rest of the application in Android Studio.
Is it possible to make something in Godot and export/integrate that into an Android Studio project? Maybe as a separate Activity or Fragment?
If not possible in Godot, is it possible in some other similar game engine?
It seems it is indeed possible to do this in Godot (github discussion), but there is no documentation for it yet (github discussion).
However I discovered it is possible to run LibGDX code in a fragment of an activity (wiki page). I ended up doing it with LibGDX both because I found it to have less of a learning curve from my experience, and it would still be part of the android application and I could pass callbacks and other Java objects back and forth between the Android specific features and LibGDX game logic.
I can figure out how to embed a unity project inside an Android project from articles on internet and Unity's own Learning section http://unity3d.com/learn. What I am having trouble with is communicating between Unity and Android.
I need to send Unity some JSON data which will contain numbers and values to display and the URLs for a couple of images. From there on inside unity's scene I want to do some animation. Based on the selection made by the user, I need to send appropriate requests to our server and open different activities.
In normal Android development, I would pass information from one activity to another using Bundle, but I can't figure out how to do the same with Unity and Android. Getting user selection from Unity's scene to my application is also a problem that needs to be solved.
Unity game is not a normal Android app. It's more like a library integrated into an Android app.
Unity docs demonstrates that to call methods on Android native side from Unity you can use AndroidJavaClass (for Java class references and static calls) and AndroidJavaObject (for references to objects).
To interact the other way around you can use UnitySendMessage() in Java. The last parameter in UnitySendMessage() is an optional string argument that you can use to pass JSON to Unity.
In Unity you can either use JsonUtility.FromJson for deserialization or some 3rd party scripts for json parsing, there are a lot on github.
We are new to unity, and experimenting with a cardboard component. This is a separate project for now, but we would like to move this code over to our existing projects and have it called from non unity activities/controllers. But is there a way for the two technologies to share data? Based on some choices in the non-unity part of the app, it will change what URL the unity part needs to call. Can we use NSUserDefaults/SharedPreferences for Unity to get data from the other native side?
Unity can communicate with native code through the plugin architecture, documented here:
http://docs.unity3d.com/Manual/Plugins.html
This is way too big a subject for me to provide more than this frowned-upon link-only answer.
I have an android application.
Part of the features of the app is to play ogg files.
I tried using the MediaPlayer for this task, but it caused huge slowdown of the app on the first play.
I'm guessing this is because the music file is loaded whole into memory, which leaves less memory for the app.
The question is, is it possible to use only the Music API of LibGdx for this task?
Can I use it without all the stuff with the application of LibGdx, since I have my own activities written in pure Android code.
Well, i would recommend to take a look into the Music backend of libgdx. There is code for the regular music Api which you can take a look at. Everything there is pure android and i am sure that you can take snippets of it to create your own musik player.
I would recommend to put that into it's own thread so it does not effect your other code. Use a kind of event system to start stop new songs for example.
I dont think, that you can simply integrate a part of libgdx to your project. If you try to take a look at the wiki about interfaceing with platform code. Create an interface in your android project and create a player in the core project of libgdx. Now just call that interface inside of your android project and it get forwared to the libgdx core "musicplayer".
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.
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:
Create a simple Unity Project.
Create an Android native plugin. Can be an activity or a simple class.
Export the .jar or .aar from Android Studio (i recommend the .aar since it's the android studio library. There you can manage the AndroidManifest.xml and then Unity will merge it with the final one)
Put the .aar into Unity project under Assets/Plugins/Android folder.
Create a c# script calling for your class method.
Build the .apk from Unity (Remember adding the company, product name and bundle id)
Run the apk in a device.
Test
I'm not sure since I haven't worked with Unity before. But there are some ways to transfer data between activities, I hope it'll help you.
Intent
Parcelable