Last active
January 12, 2022 08:29
-
-
Save superbderrick/846a0ec963fd4ba265f5f09274d7b536 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
(void)initUnity | |
{ | |
[self setUfw: UnityFrameworkLoad()]; | |
[[self ufw] setDataBundleId: "com.unity3d.framework"]; | |
[[self ufw] registerFrameworkListener: self]; | |
[NSClassFromString(@"FrameworkLibAPI") registerAPIforNativeCalls:self]; | |
[[self ufw] runEmbeddedWithArgc: gArgc argv: gArgv appLaunchOpts: appLaunchOpts]; | |
} | |
} | |
UnityFramework* UnityFrameworkLoad() | |
{ | |
NSString* bundlePath = nil; | |
bundlePath = [[NSBundle mainBundle] bundlePath]; | |
bundlePath = [bundlePath stringByAppendingString: @"/Frameworks/UnityFramework.framework"]; | |
NSBundle* bundle = [NSBundle bundleWithPath: bundlePath]; | |
if ([bundle isLoaded] == false) [bundle load]; | |
UnityFramework* ufw = [bundle.principalClass getInstance]; | |
if (![ufw appController]) | |
{ | |
// unity is not initialized | |
[ufw setExecuteHeader: &_mh_execute_header]; | |
} | |
return ufw; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment