Reputation: 520
I'm developing an Android app and I need to integrate Unity games/screens in it. I've already exported and added one Unity scene/project to my android app but I cannot figure out how to add two.
I found two main approaches to this:
Does anyone have a solution for this? Either one of the solutions mentioned above would be okay for me.
I'm experienced in Android but a beginner in Unity so I think I might be doing something wrong in the unity code.
I have the unity projects and Android apps I created for the second approach in the following git repository.
https://github.com/hadi-mehmood/AndroidUnityIntegrationSample
Upvotes: 2
Views: 1906
Reputation: 2016
Here is one solution to your problem:
First, All things happen inside unity are in one activity.
loading
scene that starts first (using unity BuildSettings
) and does not do anythingloading
scene, write a SceneLoader
script to wait for a command to load a minigame scene.UnityPlayer. UnitySendMessage("Gameobject Name","Method","Message")
Activity
call the method above and it should do the work.Sample SceneLoader:
public class MySceneLoader : MonoBehaviour
{
private void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
}
Upvotes: 2