FairyGUI.UIPanel.CreateContainer C# (CSharp) Method

CreateContainer() public method

public CreateContainer ( ) : void
return void
        void CreateContainer()
        {
            if (!Application.isPlaying)
            {
                Transform t = this.transform;
                int cnt = t.childCount;
                while (cnt > 0)
                {
                    GameObject go = t.GetChild(cnt - 1).gameObject;
                    if (go.name == "UI(AutoGenerated)")
                        UnityEngine.Object.DestroyImmediate(go);
                    cnt--;
                }
            }

            this.container = new Container(this.gameObject);
            this.container.renderMode = renderMode;
            this.container.renderCamera = renderCamera;
            this.container.touchable = !touchDisabled;
            this.container._panelOrder = sortingOrder;
            this.container.fairyBatching = fairyBatching;
            if (Application.isPlaying)
            {
                SetSortingOrder(this.sortingOrder, true);
                if (this.hitTestMode == HitTestMode.Raycast)
                    this.container.hitArea = new BoxColliderHitTest(this.gameObject.AddComponent<BoxCollider>());

                if (setNativeChildrenOrder)
                {
                    CacheNativeChildrenRenderers();

                    this.container.onUpdate = () =>
                    {
                        int cnt = _renders.Count;
                        int sv = UpdateContext.current.renderingOrder++;
                        for (int i = 0; i < cnt; i++)
                        {
                            Renderer r = _renders[i];
                            if (r != null)
                                _renders[i].sortingOrder = sv;
                        }
                    };
                }
            }
        }