Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by davedev · Mar 26, 2012 at 07:16 PM · iosmemorygarbage collection

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?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Paulius-Liekis · Jan 15, 2016 at 10:00 PM 0
Share

Have you figured out how to release Unity from your wrapper?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges