functionUpdate (){// Early out if the player is too far away. if (Vector3.Distance(transform.position, target.position) > 100) return; perform real work work...}
functionOnTriggerEnter (c : Collider){ if (c.CompareTag("layer")) enabled = ***e;}functionOnTriggerExit (c : Collider){ if (c.CompareTag("layer")) enabled = false;}
使用协同程序。Update的问题是他在每帧都发生。很可能只需要5秒钟检查一次玩家的距离。这可以节约大量的处理周期。
An increasing number of people are beginning to realize that education is not complete with graduation.