-
-
Save ppengotsu/a9d71f63fb2842e54a4e34253368ac17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.m | |
// testuaa3 | |
// | |
// Created by sakumakatsuya on 2022/07/19. | |
// | |
#import "ViewController.h" | |
#import "AppDelegate.h" | |
#import "main.h" | |
@implementation ViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view. | |
} | |
- (IBAction)TouchedButton1:(id)sender{ | |
AppDelegate* appledelgate = (AppDelegate*)UIApplication.sharedApplication.delegate; | |
[(appledelgate.UnityFrameworkLoad) unloadApplication]; | |
} | |
- (IBAction)TouchedButton2:(id)sender{ | |
[self initUnity]; | |
} | |
- (void)initUnity | |
{ | |
NSLog(@"initUnity"); | |
AppDelegate* appledelgate = (AppDelegate*)UIApplication.sharedApplication.delegate; | |
appledelgate.ufw = [appledelgate UnityFrameworkLoad]; | |
// Set UnityFramework target for Unity-iPhone/Data folder to make Data part of a UnityFramework.framework and uncomment call to setDataBundleId | |
// ODR is not supported in this case, ( if you need embedded and ODR you need to copy data ) | |
[appledelgate.ufw setDataBundleId: "com.unity3d.framework"]; | |
[appledelgate.ufw registerFrameworkListener: self]; | |
// [NSClassFromString(@"FrameworkLibAPI") registerAPIforNativeCalls:self]; | |
[appledelgate.ufw runEmbeddedWithArgc: gArgc argv: gArgv appLaunchOpts: appledelgate.appLaunchOpts]; | |
// set quit handler to change default behavior of exit app | |
[appledelgate.ufw appController].quitHandler = ^(){ NSLog(@"AppController.quitHandler called"); }; | |
} | |
- (void)showHostMainWindow | |
{ | |
[self showHostMainWindow:@""]; | |
} | |
- (void)showHostMainWindow:(NSString*)color | |
{ | |
AppDelegate* appledelgate = (AppDelegate*)UIApplication.sharedApplication.delegate; | |
// appledelgate.window.rootViewController= self; | |
// [appledelgate.window makeKeyAndVisible]; | |
} | |
- (void)unityDidUnload:(NSNotification*)notification | |
{ | |
NSLog(@"unityDidUnload called"); | |
AppDelegate* appledelgate = (AppDelegate*)UIApplication.sharedApplication.delegate; | |
[appledelgate.ufw unregisterFrameworkListener: self]; | |
[appledelgate.ufw.appController.window setHidden:true]; | |
appledelgate.ufw=nil; | |
[self showHostMainWindow:@""]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment