zoukankan      html  css  js  c++  java
  • UNITY优化资料收集

    U3D手册:

    Optimizing garbage collection in Unity games

    https://zhuanlan.zhihu.com/p/25306993  

    https://github.com/mc-gulu/gl-bits/tree/master/(2017)%20unity-gc-cheatsheet 这个收集很全,也很新,结合项目得出的实际经验值得参考  

    https://docs.unity3d.com/Manual/MobileProfiling.html 注意这里说明了MONO堆是只增不减的,在释放时并不是释放给操作系统,而是给MONO堆。

    U3D的内存= UNITY内存+ MONO内存。

    UNITY内存是引擎在C++层的堆内存: 包括:Asset data (Textures, Meshes, Audio, Animation, etc), Game objects, Engine internals (Rendering, Particles, Physics, etc). Use Profiler.usedHeapSize to get the total used Unity memory.

    MONO堆是托管堆。在C#层申请的内存都属于托管堆。

     Use System.GC.GetTotalMemory to get the total used Mono memory.  

    此文档中还提到了不要在移动平台使用 OnGUI(),在它里面会申请大量的内存。这一点不知道UNITY升级了IMGUI后还是否存在,有待测试。

    可以使用下面这些API在游戏中实现自己的内存剖析功能:

    You can also make your own tool using Unity API calls:-

    • FindObjectsOfTypeAll (type : Type) : Object[]
    • FindObjectsOfType (type : Type): Object[]
    • GetRuntimeMemorySize (o : Object) : int
    • GetMonoHeapSize
    • GetMonoUsedSize
    • Profiler.BeginSample/EndSample - profile your own code
    • UnloadUnusedAssets () : AsyncOperation
    • System.GC.GetTotalMemory/Profiler.usedHeapSize

     https://unity3d.com/de/learn/tutorials/topics/performance-optimization/optimizing-garbage-collection-unity-games?playlist=44069 

    U3D 内存查看工具 MemoryProfiler 

    安卓内存查看工具:android profiler

  • 相关阅读:
    ssh免密登录
    jdk安装
    jq选择器
    使用<button></button>标签
    mysql连接字符串
    如何把maven项目转成web项目
    pl/sql连接远程oracle
    Oracle 存储过程
    SQL Server存储过程
    MySQL存储过程
  • 原文地址:https://www.cnblogs.com/timeObjserver/p/9596700.html
Copyright © 2011-2022 走看看