is there a way to destroy unity completely in ios app?
I have a ios app(called nativeApp), then i want to add a new function made by Unity. I want enter the new function launch unity, destroy unity completely when exited. i create a class UnityNativeSwapManager for the task;
xcode version:8.2.1
unity version:5.5.1f1
question: call loadUnity -> releaseUnity is ok! But call loadUnity again crash.
Dreamora
(void)showUnityWindow { self.nativeWindow.hidden = YES; [self.unityWindow makeKeyAndVisible];
_backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_backBtn setTitle:@"back" forState:UIControlStateNormal]; [self.unityWindow addSubview:_backBtn]; [_backBtn addTarget:self action:@selector(releaseUnity) forControlEvents:UIControlEventTouchUpInside]; _backBtn.frame = CGRectMake(10, 100, 70, 50); _backBtn.backgroundColor = [UIColor redColor];
}
(void)hideUnityWindow { self.nativeWindow.hidden = NO; [self.nativeWindow makeKeyAndVisible]; self.unityWindow.hidden = YES; }
(void)releaseUnity { UnityShutdownTrampoline(); [self hideUnityWindow]; [_unityAppController applicationWillTerminate:[UIApplication sharedApplication]]; _unityAppController = nil; }
Answer by julapy · Sep 26, 2017 at 06:01 AM
would also like to know if this is possible. i don't like the idea of unity always running and taking up resources in a native ios app. it should be created when needed and destroyed when not being used.
Answer by Nitin_CMLABS · Dec 13, 2018 at 09:30 AM
Hey Guys, any solution on above issue ? I am facing same problem and Unity is not destroying when switching back to native iOS APP.