Hello. I Have the problem with close unity application in native app. When I opening unity app from native application, every time RAM is increasing and after N times application is crashed.
How I run unity app from native:
NSArray* arguments = [[NSProcessInfo processInfo] arguments];
NSInteger count = [arguments count];
char **array = (char **)malloc((count + 1) * sizeof(char*));
for (NSInteger i = 0; i < count; i++) {
array[i] = strdup([[arguments objectAtIndex:i] UTF8String]);
}
array[count] = NULL;
char** argv = array;
[[UnityFramework getInstance] registerFrameworkListener: self];
[[UnityFramework getInstance] runEmbeddedWithArgc:1 argv:argv appLaunchOpts:@{}];
How I close unity app:
[[UnityFramework getInstance] unloadApplication];
- (void)unityDidUnload:(NSNotification*)notification {
[[UnityFramework getInstance] unregisterFrameworkListener: self];
AppDelegate *app = (AppDelegate*) UIApplication.sharedApplication.delegate;
[app.window makeKeyAndVisible];
}
1 Opening
1 Close
2 Opening
2 Close
3 Opening
3 Close
4 Opening
4 Close