FairyGUI.GComponent.AddChild C# (CSharp) Method

AddChild() public method

Add a child to the component. It will be at the frontmost position.
public AddChild ( GObject child ) : GObject
child GObject A child object
return GObject
        public GObject AddChild(GObject child)
        {
            AddChildAt(child, _children.Count);
            return child;
        }

Usage Example

Example #1
0
        public MyDragDropManager()
        {
            _agent = (GComponent)UIObjectFactory.NewObject("component");
            _agent.gameObjectName = "MyDragDropAgent";
            _agent.SetHome(GRoot.inst);
            _agent.touchable = false;//important
            _agent.draggable = true;
            //_agent.SetSize(100, 100);

            _agent.sortingOrder = int.MaxValue;
            _agent.onDragEnd.Add(__dragEnd);

            loader_a = (GLoader)UIObjectFactory.NewObject("loader");
            loader_a.SetPivot(0.5f, 0.5f, true);
            loader_a.align         = AlignType.Center;
            loader_a.verticalAlign = VertAlignType.Middle;

            loader_b = (GLoader)UIObjectFactory.NewObject("loader");
            loader_b.SetPivot(0.5f, 0.5f, true);
            loader_b.align         = AlignType.Center;
            loader_b.verticalAlign = VertAlignType.Middle;

            _agent.AddChild(loader_a);
            _agent.AddChild(loader_b);
        }
All Usage Examples Of FairyGUI.GComponent::AddChild