| | |
| | |
|
| | | public static void GetCpuAndMemory(out int _cpu, out int _memory)//内存单位是MB
|
| | | {
|
| | | _cpu = Environment.ProcessorCount;
|
| | | switch (Application.platform)
|
| | | try
|
| | | {
|
| | | case RuntimePlatform.Android:
|
| | | _memory = SDKUtility.Instance.Device.totalMemory;
|
| | | break;
|
| | | case RuntimePlatform.IPhonePlayer:
|
| | | _memory = IsLowMemory() ? 1 : 2 * 1024;
|
| | | break;
|
| | | default:
|
| | | _memory = 4 * 1024;
|
| | | break;
|
| | | _cpu = Environment.ProcessorCount;
|
| | | switch (Application.platform)
|
| | | {
|
| | | case RuntimePlatform.Android:
|
| | | _memory = SDKUtility.Instance.Device.totalMemory;
|
| | | break;
|
| | | case RuntimePlatform.IPhonePlayer:
|
| | | _memory = IsLowMemory() ? 1 : 2 * 1024;
|
| | | break;
|
| | | default:
|
| | | _memory = 4 * 1024;
|
| | | break;
|
| | | }
|
| | |
|
| | | cpu = _cpu;
|
| | | memory = _memory;
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | Debug.Log(ex);
|
| | | _cpu = 2;
|
| | | _memory = 2 * 1024;
|
| | | }
|
| | |
|
| | | cpu = _cpu;
|
| | | memory = _memory;
|
| | | }
|
| | | |
| | | } |