mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
fix graphics can't show in editor (#5415)
This commit is contained in:
@@ -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 () {
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user