FairyGUI.UIContentScaler.OnEnable C# (CSharp) Method

OnEnable() private method

private OnEnable ( ) : void
return void
        void OnEnable()
        {
            if (Application.isPlaying)
            {
                //播放模式下都是通过Stage自带的UIContentScaler实现调整的,所以这里只是把参数传过去
                UIContentScaler scaler = Stage.inst.gameObject.GetComponent<UIContentScaler>();
                if (scaler != this)
                {
                    scaler.scaleMode = scaleMode;
                    if (scaleMode == ScaleMode.ScaleWithScreenSize)
                    {
                        scaler.designResolutionX = designResolutionX;
                        scaler.designResolutionY = designResolutionY;
                        scaler.screenMatchMode = screenMatchMode;
                    }
                    else if (scaleMode == ScaleMode.ConstantPhysicalSize)
                    {
                        scaler.fallbackScreenDPI = fallbackScreenDPI;
                        scaler.defaultSpriteDPI = defaultSpriteDPI;
                    }
                    else
                    {
                        scaler.constantScaleFactor = constantScaleFactor;
                    }
                    scaler.ApplyChange();
                    GRoot.inst.ApplyContentScaleFactor();
                }
            }
            else //Screen width/height is not reliable in OnEnable in editmode
                _changed = true;
        }