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?


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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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