FairyGUI.UIPackage.CreateObjectFromURL C# (CSharp) Method

CreateObjectFromURL() public static method

Create a UI object.
public static CreateObjectFromURL ( string url ) : GObject
url string Resource url.
return GObject
        public static GObject CreateObjectFromURL(string url)
        {
            PackageItem pi = GetItemByURL(url);
            if (pi != null)
                return pi.owner.CreateObject(pi, null);
            else
                return null;
        }

Same methods

UIPackage::CreateObjectFromURL ( string url, System userClass ) : GObject
UIPackage::CreateObjectFromURL ( string url, CreateObjectCallback callback ) : void

Usage Example

Example #1
0
        override protected void ConstructExtension(ByteBuffer buffer)
        {
            buffer.Seek(0, 6);

            _buttonController = GetController("button");
            _titleObject      = GetChild("title");
            _iconObject       = GetChild("icon");

            string str = buffer.ReadS();

            if (str != null)
            {
                dropdown = UIPackage.CreateObjectFromURL(str) as GComponent;
                if (dropdown == null)
                {
                    Debug.LogWarning("FairyGUI: " + this.resourceURL + " should be a component.");
                    return;
                }

                _list = dropdown.GetChild("list") as GList;
                if (_list == null)
                {
                    Debug.LogWarning("FairyGUI: " + this.resourceURL + ": should container a list component named list.");
                    return;
                }
                _list.onClickItem.Add(__clickItem);

                _list.AddRelation(dropdown, RelationType.Width);
                _list.RemoveRelation(dropdown, RelationType.Height);

                dropdown.AddRelation(_list, RelationType.Height);
                dropdown.RemoveRelation(_list, RelationType.Width);

                dropdown.SetHome(this);
            }

            displayObject.onRollOver.Add(__rollover);
            displayObject.onRollOut.Add(__rollout);
            displayObject.onTouchBegin.Add(__touchBegin);
            displayObject.onTouchEnd.Add(__touchEnd);
        }
All Usage Examples Of FairyGUI.UIPackage::CreateObjectFromURL