- Home /
Releasing Unity Memory from an iOS App
Currently we're successfully loading Unity from within an existing iOS app. You can use the app like normal, and with a button press it loads an entire Unity "module" in a new UIWindow.
We used this as our inspiration:
http://technology.blurst.com/a-cocoa-based-frontend-for-unity-iphone-applications/
To communicate between Unity and iOS, we used this as our inspiration: http://www.tinytimgames.com/2010/01/10/the-unityobjective-c-divide/
It all works rather well, except, when the Unity module finishes with it's scene and the user is returned back to the native app the memory usage/allocation never returns back to pre-Unity load values!
The project is written in ARC, but we overrode the class where Unity gets loaded from and manually released the UIWindow and appropriate references to no avail. In Unity, we also advanced the content to a new blank scene to encourage garbage collection to clean up the previous animations - which helped quite a bit, but it seems Unity takes up a decent amount of memory just to "exist".
Are we missing something here? Anyone have any suggestions to reduce memory consumption or properly release Unity? Is it possible to just load Unity in a UIView instead of a full blown UIWindow?
Have you figured out how to release Unity from your wrapper?
Answer by jingato · May 10, 2012 at 02:15 PM
Hi, I'm trying to do the same exact thing. Did you ever find a solution? I'm starting unity by calling
_unity = [[AppController alloc] init];
[_unity applicationDidFinishLaunching:[UIApplication sharedApplication]];
I found I can exit it by calling [_window makeKeyAndVisible];
but when I do that, Unity is still obviously taking up memory, and on top of that, if I try to run it again it crashes. I'd love to be able to just run it in a view like you said, but I'd be happy with just cleaning up the memory of the window and being able to run it again.
I'm also using ARC in my project.
Thanks
Your answer
Follow this Question
Related Questions
Unity iOS controlling heap size growth 1 Answer
Memory footprint worries - Web/Standalone vs iOS 0 Answers
Unexpected memory overhead of textures on iOS 0 Answers
Unity3D app crashes out after error "Warning -> ApplicationDidReceiveMemoryWarning' 1 Answer
Unity IOS(IPad2) auto exit app after loaded too many images 1 Answer