-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为node添加renderable 属性, 用来实现"不渲染当前node及其子节点" 的功能 #17159
Comments
ECS 机制下不适合在 Node 里加逻辑去控制。可以通过 Node.getComponentsInChildren() 找到渲染组件,然后去 disable 掉。 |
那能不能把这个标记加在RenderEntity中,Node.getComponentsInChildren()深度遍历的消耗也是很大的 |
那不还是遍历所有子节点 以及会执行 很多的 walk 吗? 性能太低了 |
@minggo 希望正针对这个需求 进一步讨论下. https://forum.cocos.org/t/topic/158944/ 我在论坛发了个帖子.
如果不想增加属性, 希望能提供一个 便于 开发者重写的方式. 比如
改为
这样开发者如果有我这种特殊需求, 可以重写 canWalk. |
Use Case
需求:
只是不渲染 当前node及其子节点, 但是上面的 组件正常运转 (所以 node.active 无法满足需求).
目前 设置node.Layer = 0 能实现类似功能, 但是比较低效, 因为要深度遍历所有子节点 来改变 所有子节点的Layer.
而且如果子节点的 Layer 不一样, 还要备份之前的值, 用来还原. (而且 Layer 好像不能避免 walk() ???)
希望能提供一个更纯粹的属性来控制渲染.
比如 node.renderable , 那么在2D场景下 可以在 walk 时进行如下判断.
当然 其实有时候也希望3D场景预备这个能力
Problem Description
如上所述
Proposed Solution
No response
How it works
No response
Alternatives Considered
无
Additional Information
No response
The text was updated successfully, but these errors were encountered: