Skip to content

ComputedNode's size returns 0.0 with Added filter in Query #17997

Answered by ickshonpe
MuongKimhong asked this question in Q&A
Discussion options

You must be logged in to vote

My guess is that my_system is running before ui_layout_system has updated the ComputedNode's size the first time.
And without the filter it prints out the size every frame so the last size it prints out will be non-zero.
Try changing my_system's query filter to:

query: Query<(&ComputedNode, &Node), Or<(Added<MyComponent>, Changed<ComputedNode>)>>,

And you should see that the first frame it prints Vec2(0.0, 0.0) and then the next frame it prints the computed size of the node.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MuongKimhong
Comment options

Answer selected by MuongKimhong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants