zoukankan      html  css  js  c++  java
  • 代码优化

    优化:
    unity只维护localPos, localeRot, local Scale,所以尽量避免直接只用position, rotation, scale. 如果必须要使用,则可以使用caching防止同一帧里多次修改transform
    1 UpdateLateUpdateFixedUpdateStart
    2 GameObject.Find
    3 Component cache, GetComponent("")
    4 DistToHost Change to SqrMagnitude, magnitude所有地方 Update中(替换)
    5 caching transform changes
    6 gameObject != null --> !System.Object.ReferenceEquals(gameObject, null) 减少native-managerment bridge (数量巨大才会有效果)

    7.频繁实例化,销毁的类缓存

    7.On** 空函数移除

    8.Dictionary的foreach遍历优化改成获取迭代器去while去执行

    9,减少GC,减少new,代码不需要了回收,下次继续使用

    OnRenderObject
    OnTriggerExit
    OnTriggerEnter
    OnPreRender
    OnPreCull
    OnPostRender
    OnMouseOver
    OnMouseUp
    OnMouseExit
    OnMouseEnter
    OnMouseDrag
    OnMouseDown
    OnLevelWasLoaded
    OnEnable
    OnDisable
    OnDestroy
    OnCollisionEnter
    OnAnimatorIK
    OnApplicationFocus
    OnApplicationPause
    OnApplicationQuit
    OnAudioFilterRead
    OnBecameInvisible
    OnBecameVisible

  • 相关阅读:
    POJ2594拐点弯的二分
    poj1523赤裸裸的割点
    POJ2239二分匹配
    对java多线程的一些浅浅的理解
    POJ3216 最小路径覆盖
    POJ1719二分匹配
    [算法]本学期算法作业
    [离散数学II]2017.3.29
    [离散数学II]2017.3.29
    [概率论]2017.3.29
  • 原文地址:https://www.cnblogs.com/mttnor/p/6860025.html
Copyright © 2011-2022 走看看