简体   繁体   中英

In a Unity3D - Android project .. how to get memory warnings?

How to be alerted of memory warnings? Unity3D, building to Android.

Cheers.

据我所知,Android中没有内置功能。

You can subscribe to Application.lowMemory Documentation

For example, in some monoBehaviour starting your game:

private void Start() 
{
    Application.lowMemory += ReportSystemLowMemory;
} 


private void ReportSystemLowMemory() 
{
    Debug.LogWarning("Warning: Low memory");
}
  • Be sure to don't subscribe ReportSystemLowMemory more than once.
  • Also unsubscribing it would be a good practice, ie Application.lowMemory -= ReportSystemLowMemory when you are close your app/game.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM