I have a Unity project embed into a native Swift project. Unity part is used for a short period of time (as a mini-game). It should be presented and then to be dismissed. I have no issues with displaying it, but there is no proper way to dismiss UnityAppController. The only workaround how to dismiss it is next:
// unityFramework object is `UnityFramework`
// unloadApplication is called before
func unityDidUnload(_ notification: Notification!)
{
print("unityDidUnload")
self.window?.makeKeyAndVisible()
self.unityFramework?.unregisterFrameworkListener(self)
self.unityFramework?.appController()?.window.resignKey()
self.unityFramework?.appController()?.window = nil
self.unityFramework = nil
}
The code above removes the game from the main windows, but it still stays in memory.
Functions available within UnityFramework doesn't help at all. - (void)unloadApplication; just freezes the Unity app; - (void)quitApplication:(int)exitCode; kills the main app.