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
In bevy 0.4 Text value update is not rendered when was updated on stage::POST_UPDATE. Instead i see the original text i put when created component. Text update render works if system is on stage::UPDATE. I made simple example using default bevy 0.4.0:
cargo add bevy
use bevy::prelude::*;fnmain(){App::build().add_plugins(DefaultPlugins).add_startup_system(setup_ui.system()).add_system_to_stage(stage::POST_UPDATE, text_update_system.system()).run();}pubfnsetup_ui(commands:&mutCommands,asset_server:Res<AssetServer>){
commands
.spawn(CameraUiBundle::default()).spawn(TextBundle{style:Style{align_self:AlignSelf::FlexEnd,
..Default::default()},text:Text{value:"Statup text".to_string(),font: asset_server.load("FiraSans-Bold.ttf"),style:TextStyle{font_size:30.0,color:Color::BLACK,
..Default::default()},
..Default::default()},
..Default::default()});}pubfntext_update_system(time:Res<Time>,mutquery:Query<&mutText>){formut text in query.iter_mut(){
text.value = format!("Updated text. Delta time: {}", time.delta_seconds());}}
cargo run
If i check text/text.value using dbg!() i see correct, updated value, but only original value is rendered.
For example, in bevy 0.3.0 following code kind of works:
use bevy::prelude::*;fnmain(){App::build().add_plugins(DefaultPlugins).add_startup_system(setup_ui.system()).add_system_to_stage(stage::POST_UPDATE, text_update_system.system()).run();}pubfnsetup_ui(mutcommands:Commands,asset_server:Res<AssetServer>){
commands
.spawn(UiCameraComponents::default()).spawn(TextComponents{style:Style{align_self:AlignSelf::FlexEnd,
..Default::default()},text:Text{value:"Statup text".to_string(),font: asset_server.load("FiraSans-Bold.ttf"),style:TextStyle{font_size:30.0,color:Color::BLACK,
..Default::default()},
..Default::default()},
..Default::default()});}pubfntext_update_system(time:Res<Time>,mutquery:Query<&mutText>){formut text in query.iter_mut(){
text.value = format!("Updated text. Delta time: {}", time.delta_seconds);}}
It has some strange artifacts when rendered, but the text is not default value i set. I hit this issue while attempted to update bevy_rapier from bevy 0.3.0 to 0.4.0.
What i expected to happen
Text should be rendered with updated value at least in the next frame.
What actually happened
Text render only original value and is never updated.
Additional information
I made bevy-0.4 and bevy-0.3 branches in example repository reproducing issue.
I always have warning in my console:
MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
But example works on bevy_rapier targeting bevy-0.3.0, and no longer works on nearly same example targeting bevy-0.4.0, so i don't think it's driver issue.
The text was updated successfully, but these errors were encountered:
I would argue that this isn't a bug. The POST_UPDATE stage exists to respond to "game logic" changes that happen in UPDATE. Changing text is "game logic" and therefore belongs in UPDATE (or a stage between update and POST_UPDATE).
I initially considered it a bug because it should at least be updated in next frame, but it doesn't?
How do i calculate time spent in update after update and output it as a text?
or a stage between update and POST_UPDATE
For me it looks logical to use POST_UPDATE to calculate time spent in update.
Maybe we need better naming?
I initially considered it a bug because it should at least be updated in next frame, but it doesn't?
It doesn't because it relies on Bevy's change detection features, which are very efficient, but as a result require clearing the change state at the end of the frame.
How do i calculate time spent in update after update and output it as a text?
You can either add a new stage between UPDATE and POST_UPDATE (which would allow you to report the time on the same frame), or you can record the time to run UPDATE and queue it up in a resource that is dequeued on the next frame (which would add one frame of lag).
For me it looks logical to use POST_UPDATE to calculate time spent in update.
Maybe we need better naming?
That and/or better docs. If you have any suggestions let me know.
I'm closing this as everything is working as expected, but I'm definitely down to continue discussing ways to improve the situation.
bevy 0.4.0
Arch linux with intel drivers
What i did
In bevy 0.4 Text value update is not rendered when was updated on
stage::POST_UPDATE
. Instead i see the original text i put when created component. Text update render works if system is onstage::UPDATE
. I made simple example using default bevy 0.4.0:If i check
text
/text.value
usingdbg!()
i see correct, updated value, but only original value is rendered.For example, in bevy 0.3.0 following code kind of works:
It has some strange artifacts when rendered, but the text is not default value i set. I hit this issue while attempted to update bevy_rapier from bevy 0.3.0 to 0.4.0.
What i expected to happen
Text should be rendered with updated value at least in the next frame.
What actually happened
Text render only original value and is never updated.
Additional information
I made bevy-0.4 and bevy-0.3 branches in example repository reproducing issue.
I always have warning in my console:
But example works on bevy_rapier targeting bevy-0.3.0, and no longer works on nearly same example targeting bevy-0.4.0, so i don't think it's driver issue.
The text was updated successfully, but these errors were encountered: