void Start() { mController = gameObject.GetComponent <SeparateEntityController>(); if (mController == null) { mController = gameObject.AddComponent <SeparateEntityController>(); } mController.Init(bounds.center, bounds.size, attribute.asyn, attribute.maxCreateCount, attribute.minCreateCount, attribute.refreshTime, attribute.destroyTime, attribute.treeType, attribute.treeDepth); for (int i = 0; i < transform.childCount; ++i) { var entity = transform.GetChild(i).GetComponent <STSceneEntity>(); if (entity) { mController.AddSceneEntity(entity); } } }
void OnEnable() { mTarget = (SeparateEntityController)target; }