FairyGUI.UIPainter.CreateUI C# (CSharp) Method

CreateUI() public method

public CreateUI ( ) : void
return void
        public void CreateUI()
        {
            if (_ui != null)
            {
                _ui.Dispose();
                _ui = null;
                DestroyTexture();
            }

            _created = true;

            if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(componentName))
                return;

            _ui = (GComponent)UIPackage.CreateObject(packageName, componentName);
            if (_ui != null)
            {
                this.container.AddChild(_ui.displayObject);
                ((MeshColliderHitTest)this.container.hitArea).SetArea(0, 0, _ui.width, _ui.height);
                this.container.size = _ui.size;
                _texture = CaptureCamera.CreateRenderTexture(Mathf.RoundToInt(_ui.width), Mathf.RoundToInt(_ui.height), false);
                _renderer = this.GetComponent<Renderer>();
                if (_renderer != null)
                {
                    _renderer.sharedMaterial.mainTexture = _texture;
                    _captureDelegate = Capture;
                    if (_renderer.sharedMaterial.renderQueue == 3000) //Set in transpare queue only
                    {
                        this.container.onUpdate = () =>
                        {
                            UpdateContext.OnEnd += _captureDelegate;
                        };
                    }
                }
            }
            else
                Debug.LogError("Create " + componentName + "@" + packageName + " failed!");
        }

Usage Example

 static public int CreateUI(IntPtr l)
 {
     try {
         FairyGUI.UIPainter self = (FairyGUI.UIPainter)checkSelf(l);
         self.CreateUI();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
All Usage Examples Of FairyGUI.UIPainter::CreateUI