Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a typical UIKit application with three buttons - one opens an RSS feed in a UITableView, the second opens some kind of gallery view, and the third opens a Unity 3D game.

Is it possible and how easy it is to support both in one application?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

This will be improbably difficult. Unity is not a standalone view wholly contained within a UIView subclass instance; if it were, this would be easy enough, you'd just add the view as a subview when you wanted to activate the Unity game and remove it when you were done (or use any number of similar UIView manipulation techniques).

Unity, however, expects to be the authoritative source of the application's behavior, so trying to host a Unity game within a "regular" iOS application is going to result in you fighting that behavior and spending a lot of effort for minimal gain.

You should consider implementing the behavior the other way around: have a Unity game which occasionally defers to some Objective-C based UIKit code via native plugins, which basically involves:

  • creating an Xcode project or target that contains the Objective-C code for manipulating the desired UIView objects.
  • conforming to the Unity plugin API so you have an entry point into your plugin from the rest of your Unity project.
  • invoking that entry point as-needed.

If you are not keen on building all that yourself, something like the iOS bridge, or just resign yourself to building your GUI with Unity's built-in primitives.

share|improve this answer
1  
Took more than a year to finally get an answer. Thanks a lot for the useful info :) –  Guntis Treulands May 14 at 19:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.