在iOS上激活Unity按钮单击

时间:2013-03-21 20:49:09

标签: ios objective-c unity3d

我有一个iOS应用程序,有不同的视图,我想点击一个按钮打开一个Unity项目。这将是App的增强现实部分,因此使用Unity的qualcomm插件。 我尽可能地遵循指南http://alexanderwong.me/post/29949258838/building-a-ios-unity-uiview-uiviewcontroller,但有一些问题

  1. 理想情况下,我想通过触摸按钮加载Unity,而不是在AppStart上,我有触摸按钮时接听电话的方法,但老实说不知道应该去哪里{{1 }} ...

  2. 如果无法在按钮单击时加载Unity,那么它应该加载到应用程序:didFinishLaunchingWithOptions:,并且,如在指南中,我从AppDelegate调用AppController窗口。 。

     UnityPause: NO 
  3. 然后在AppController.mm上我有:

    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:                     (NSDictionary*)launchOptions
    {
    //unity
    BOOL returnBOOL;
    if (_unityController == nil) {
        _unityController = [[AppController alloc] init];
    }
    returnBOOL = [_unityController application:application     didFinishLaunchingWithOptions:launchOptions];
    
    //other app-loading things here...
    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    
    self.window = [[UIWindow alloc] initWithFrame:screenBounds];
    self.window.autoresizesSubviews = YES;
    NSLog(@"Will start loading Unity window");
    
    // unity, set window
    window = [_unityController window];  //App crashes here
    
    // navigation controller
    [window addSubview:navigationController.view];
    
    
    self.viewController = [[MainViewController alloc] init];
    self.viewController.useSplashScreen = YES;
    
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    
    //more loading things....
    
    return returnBOOL;
    }
    

    这引发了一个编译器错误“使用未声明的标识符_window”,好吧,我知道这是错的,他不知道_window来自哪里..但我不知道,它是应该<的地方/ em>来自..我真的不知道如何解决这个问题。

    最后,出于性能原因,如果我只需要在按钮点击时加载Unity,应该在那里调用什么? (Unity需要很长时间才能加载,我不确定是否最好在AppStart上加载它,或者在按钮单击时加载它(如果单击按钮,它看起来不会很奇怪,打开相机需要很长时间吗? )..任何帮助都会被贬低!

    谢谢! :)

0 个答案:

没有答案