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!");
}