1

Good morning!

I have just completed a game using Unity3D. My co-workers have each completed an app in native Android and iOS using Eclipse ad XCode.

The problem is, we need to integrate the game into the Android and iOS apps by having it activate inside one of their screens/scenes/activities.

Any pointers on how I could get started on this task? I am unable to find anything helpful online. Thanks in advance, any help would be much appreciated.

UPDATE

We now have the game successfully integrated into an Android App. Now we have another issue, in Unity we can input a button the quits the game. This was great while the game was a standalone app. But now that it is inside the Android app, we are looking for a way to exit the game without quitting the entire app.

Is there a specific snippet of code we can use to back out of the Unity game but not exit the whole application? Thanks!

SandyBites
  • 173
  • 2
  • 19
  • 1
    This guy added a view to hold Unity in an XCode project: https://groups.google.com/forum/#!msg/phonegap/3LKvtPWxNRk/lgisDBvPNNgJ Any technique will probably require adjustments as Unity updates change the output. Would love to know if you find a good solution. – Scott Driscoll Sep 23 '14 at 20:25

2 Answers2

6

Android:

  • Build Settings -> Android -> Check "Google Android Project" -> Export

  • Open Eclipse -> Import -> Android/Existing Android Code Into Workspace -> Choose Exported Project above.

  • Now your Unity Game is one view object in one activity. You can add others activities or others views by normal way in normal Android project.

Frank Nguyen
  • 6,493
  • 3
  • 38
  • 37
  • Thanks for the input, in the interim we were able to find out how to get it to work in Android. But for iOS, still nothing. But thanks! (y) – SandyBites Sep 03 '14 at 14:06
0

In your Unity game, you have to add a quit button within the unity game. Add the following code:

  if (Application.platform == RuntimePlatform.Android)
  {
   if (Input.GetKey(KeyCode.Escape))
   {
    Application.Quit();
   }
  }
 }
}

Now only the unity game would quit without quitting your entire game.