Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 3f6a4c2

Browse files
committed
add recreateWidget.
1 parent cee64fb commit 3f6a4c2

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

Runtime/engine/UIWidgetsPanel.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ protected override void OnDisable() {
187187
protected virtual Widget createWidget() {
188188
return null;
189189
}
190+
191+
public void recreateWidget() {
192+
Widget root;
193+
using (this._windowAdapter.getScope()) {
194+
root = this.createWidget();
195+
}
196+
197+
this._windowAdapter.attachRootWidget(root);
198+
}
190199

191200
internal void applyRenderTexture(Rect screenRect, Texture texture, Material mat) {
192201
this.texture = texture;

Runtime/ui/painting/canvas_impl.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -753,11 +753,6 @@ public void flush(Picture picture) {
753753
D.assert(this._layers[0].states.Count == 1);
754754

755755
var layer = this._currentLayer;
756-
if (layer.draws.Count == 0) {
757-
D.assert(layer.layers.Count == 0);
758-
return;
759-
}
760-
761756
using (var cmdBuf = new CommandBuffer()) {
762757
cmdBuf.name = "CommandBufferCanvas";
763758

@@ -870,6 +865,12 @@ void _drawLayer(RenderLayer layer, CommandBuffer cmdBuf) {
870865
break;
871866
}
872867
}
868+
869+
if (toClear) {
870+
this._setRenderTarget(cmdBuf, layer.rtID, ref toClear);
871+
}
872+
873+
D.assert(!toClear);
873874

874875
foreach (var subLayer in layer.layers) {
875876
cmdBuf.ReleaseTemporaryRT(subLayer.rtID);

0 commit comments

Comments
 (0)