Unity IOS集成 [英] Unity IOS integration
问题描述
对于一个项目,我需要将Unity3d集成到现有的应用程序中,我知道Unity可以充当UIApplicationDelegate.我找到了一篇有关该主题的有趣文章,但是对我来说,目前尚不清楚如何以这种方式解决问题.是否可以从ViewController重新启动委派过程?因此,当我从委托切换到viewController时,我想返回导航,然后再次初始化UIApplicationDelegate吗?
For a project I need to integrate Unity3d in an existing app I know Unity acts as a UIApplicationDelegate. I found an interesting article about this topic but it is not really clear to me how I can resolve my problems this way. Is it possible restart the delegation process from a ViewController? So when I switch to a viewController from my delegate and I want to navigate back then initialize the UIApplicationDelegate again?
我发现的文章: http://alexanderwong.me/post/29949258838/building-a -ios-unity-uiview-uiviewcontroller
预先感谢
推荐答案
您是否尝试过使用Unity来构建标准" Unity iOS应用程序,然后将现有代码集成到该应用程序中?
Have you tried using Unity to build a "standard" Unity iOS application, then integrating your existing code into that?
从Unity为iOS构建时,Unity会通过以下方法自动在应用程序委托中粘贴一个钩子:
When you build for iOS from Unity, Unity will automatically stick a hook in your Application Delegate, in the following method:
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
您可以在其中执行其他操作,但是在底部您应该会看到重要的一行:
You can do other stuff in there, but down the bottom you should see the important line:
[self startUnity:application];
因此,您可以做的就是从didFinishLaunching方法中删除该行,并将其放置在任何需要的位置.您还需要在应用程序委托中保留对UIWindow * Unity绘制的引用,以便您可以随意切换它.
So what you can do is just take that line out of the didFinishLaunching method and put it ... wherever you want. You'll also want to keep a reference to the UIWindow* Unity draws to in your application delegate, so you can switch in and out of it as you please.
因此,我对要执行的操作尚不完全清楚,但我绝对建议您首先从集成的Unity构建开始并从那里开始工作,或者如果您愿意的话,至少将其用作地图想推出自己的实施方案.
So, I'm not completely clear about exactly the things you want to do, but I definitely recommend as a first step you start with an integrated Unity build and work from there, or at least use it as a map if you want to roll your own implementation.
这篇关于Unity IOS集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!