fix graphics can't show in editor (#5415)

This commit is contained in:
JoneLau
2019-09-19 17:55:04 +08:00
committed by pandamicro
parent f3940055bd
commit bb9a7b7b06
2 changed files with 9 additions and 2 deletions
@@ -187,7 +187,11 @@ export class UITransformComponent extends Component {
public __preload () {
this.node.uiTransfromComp = this;
this.node.layer = Layers.Enum.UI_2D;
if (CC_EDITOR) {
this.node.layer = Layers.Enum.UI_3D;
} else {
this.node.layer = Layers.Enum.UI_2D;
}
}
public onDestroy () {
+4 -1
View File
@@ -48,6 +48,7 @@ import { StencilManager } from './stencil-manager';
import { UIBatchModel } from './ui-batch-model';
import { UIMaterial } from './ui-material';
import * as UIVertexFormat from './ui-vertex-format';
import { Layers } from '../../scene-graph';
export class UIDrawBatch {
public camera: Camera | null = null;
@@ -309,9 +310,11 @@ export class UI {
if (batch.model) {
if (batch.camera) {
const visFlags = batch.camera.view.visibility;
batch.model.visFlags = visFlags;
batch.model.node.layer = visFlags;
} else {
batch.model.node.layer = Layers.Enum.UI_3D;
}
for (let j = 0; j < batch.model.subModelNum; j++) {
batch.model.getSubModel(j).priority = batchPriority++;
}