You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am starting with bevy and trying to create a simple UI for showing alerts. What I had in mind was first creating a TextBundle and then a NodeBundle as a child, for the background, so the position would be inherited and I could simply change the desired size based on the text width and size.
First issue is that the child is in front of a parent, and after setting the Transform component with negative Z value, nothing happens, but the documentation says "In 2d, the z component is used for z-ordering elements: higher z-value will be in front of lower z-value." (I've used Transform::from_xyz).
Another issue is that the size of the text is not know for the child and I have no clue how can I get it in the same system.
I also had an idea to replace with_children to insert_bundle and now the z-ordering works great, but everything has been moved into bottom left corner and the text has broke into 2 lines...
So is it some kind of a bug, or am I doing something wrong? I've read much of the documentation and worked with some examples, but have no clue what's going on here. I guess that the solution would be to create the "box" first and then try to fit the text inside of it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am starting with bevy and trying to create a simple UI for showing alerts. What I had in mind was first creating a
TextBundle
and then aNodeBundle
as a child, for the background, so the position would be inherited and I could simply change the desired size based on the text width and size.First issue is that the child is in front of a parent, and after setting the Transform component with negative
Z
value, nothing happens, but the documentation says "In 2d, the z component is used for z-ordering elements: higher z-value will be in front of lower z-value." (I've usedTransform::from_xyz
).Another issue is that the size of the text is not know for the child and I have no clue how can I get it in the same system.
Here is the code for spawning ui:
And here is the result of it:

I also had an idea to replace

with_children
toinsert_bundle
and now the z-ordering works great, but everything has been moved into bottom left corner and the text has broke into 2 lines...Here's the code:
So is it some kind of a bug, or am I doing something wrong? I've read much of the documentation and worked with some examples, but have no clue what's going on here. I guess that the solution would be to create the "box" first and then try to fit the text inside of it.
Beta Was this translation helpful? Give feedback.
All reactions