/// 初始化 public void Initialize() { if (_isInitialized) { return; } //记录默认显示的优先级 _defaultShowPriority = ShowPriority; _isInitialized = true; //初始化UI组件 UIComponent[] ccs = new UIComponent[100]; int ccCnt = 0; UIUtility.GetComponentsInChildren <UIComponent>(gameObject, ccs, ref ccCnt); if (ccs != null && ccCnt > 0) { if (_uiComponents == null) { _uiComponents = new JWObjList <UIComponent>(); } for (int i = 0; i < ccCnt; i++) { ccs[i].Initialize(this); //Cache _uiComponents.Add(ccs[i]); } } }
/// 初始化渲染器 private void InitializeRenderers() { _renderers = new Renderer[20]; _rendererCount = 0; UIUtility.GetComponentsInChildren <Renderer>(this.gameObject, _renderers, ref _rendererCount); }