using UnityEngine; public class NewBehaviourScript : MonoBehaviour { public GameObject prefab; void Update() { //位置 float x = Random.Range(-10, 10); float y = Random.Range(-10, 10); float z = Random.Range(-10, 10); Vector3 pos = new Vector3(x,y,z); /
享元模式的理解: 享元模式的定义:运用共享技术支持大量细粒度对象的复用: Flyweight Pattern Definition:Use sharing to support large numbers of fine-grained efficiently. 享元模式关键词:大量.细粒度.复用.享元池.享元工厂: 当系统中存在大量的细粒度的相同或相似对象时,可以使用享元模式: 享元模式通过共享技术,实现相同或相似对象的重复利用: 享元的字面理解:享也就是分享共享的意思,元就是共享的元素.对象