可以在在编辑器模式下渲染吗?

因为项目需要,希望能实现这样一个功能:
在编辑器里勾选某一个选项的时候,在编辑器窗口里能渲染几根参考线
取消勾选的时候,隐藏这个参考线

这是一个editor only的功能

@property({
    editorOnly:true,
})
_grid_graphics : cc.Graphics = null;

@property({
    editorOnly:true,
    tooltip:"show the logic grid lines."
})
_show_grid = false;

@property
get show_grid(){
    return this._show_grid;
}

set show_grid(value){
    this._show_grid = value;
    if (this._grid_graphics == null)
    {
        this._grid_graphics = this.node.addComponent(cc.Graphics);
        this._grid_graphics.moveTo(0, 0);
        this._grid_graphics.lineTo(750, 1334);
        this._grid_graphics.strokeColor = cc.Color.RED;
        this._grid_graphics.stroke();
    }
}

我思路大概是这样的,最后发现编辑器确实执行了对应的代码,但是渲染并没有生效

请问有什么办法可以实现这样的效果?

你需要的是自定义gizmo

https://docs.cocos.com/creator/manual/zh/extension/custom-gizmo.html?h=gizmo