FairyGUI.UIPackage.GetByName C# (CSharp) Method

GetByName() public static method

Return a UIPackage with a certain name.
public static GetByName ( string name ) : UIPackage
name string Name of the package.
return UIPackage
        public static UIPackage GetByName(string name)
        {
            UIPackage pkg;
            if (_packageInstByName.TryGetValue(name, out pkg))
                return pkg;
            else
                return null;
        }

Usage Example

Example #1
0
        void OnEnable()
        {
            if (Application.isPlaying)
            {
                CreateContainer();

                if (!string.IsNullOrEmpty(packagePath) && UIPackage.GetByName(packageName) == null)
                {
                    UIPackage.AddPackage(packagePath);
                }
            }
            else
            {
                //不在播放状态时我们不在OnEnable创建,因为Prefab也会调用OnEnable,延迟到Update里创建(Prefab不调用Update)
                //每次播放前都会disable/enable一次。。。
                if (container != null)                //如果不为null,可能是因为Prefab revert, 而不是因为Assembly reload,
                {
                    OnDestroy();
                }

                EMRenderSupport.Add(this);
                screenSizeVer     = 0;
                uiBounds.position = position;
                uiBounds.size     = cachedUISize;
                if (uiBounds.size == Vector2.zero)
                {
                    uiBounds.size = new Vector2(30, 30);
                }
            }
        }
All Usage Examples Of FairyGUI.UIPackage::GetByName