FairyGUI.DisplayObject.UpdateHierarchy C# (CSharp) Method

UpdateHierarchy() public method

public UpdateHierarchy ( ) : void
return void
        void UpdateHierarchy()
        {
            if (!_ownsGameObject)
            {
                if (gameObject != null)
                {
                    //we dont change transform parent of this object
                    if (parent != null && visible)
                        gameObject.SetActive(true);
                    else
                        gameObject.SetActive(false);
                }
            }
            else if (parent != null)
            {
                ToolSet.SetParent(cachedTransform, parent.cachedTransform);

                if (_visible)
                    gameObject.SetActive(true);

                int layerValue = parent.gameObject.layer;
                if (parent._paintingMode != 0)
                    layerValue = CaptureCamera.hiddenLayer;

                if ((this is Container) && this.gameObject.layer != layerValue && this._paintingMode == 0)
                    ((Container)this).SetChildrenLayer(layerValue);

                this.layer = layerValue;
            }
            else if (!_disposed)
            {
                if (Application.isPlaying)
                {
                    if (gOwner == null || gOwner.parent == null)//如果gOwner还有parent的话,说明只是暂时的隐藏
                    {
                        ToolSet.SetParent(cachedTransform, _home);
                        if (_home == null)
                            Object.DontDestroyOnLoad(this.gameObject);
                    }
                }

                gameObject.SetActive(false);
            }
        }