bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.41k stars 3.59k forks source link

Change detection for text is more painful after text rework #15805

Open alice-i-cecile opened 1 month ago

alice-i-cecile commented 1 month ago

With the new text stuff, one thing that seems a little rough is that you may have a Text component (with text) or a Text2d or several children with spans. So if you need to "do something when text changes" you have a bunch of different places you have to look for the actual string. With spans, you also have to check the parent if you need components there (like narrowing markers, etc).

This makes doing change detection on text (for things like "if the text changed, re-localize it") a bit messy. It looks like I'm going to need, for any particular case, multiple systems that cover "all the ways there could be a string squirreled away in there"

@ItsDoot and I feel that this could probably be solved with a nice custom SystemParam type that gathers and presents this information.

cart commented 1 month ago

@ItsDoot and I feel that this could probably be solved with a nice custom SystemParam type that gathers and presents this information.

We might also be able to track + encode this information somehow in ComputedTextBlock.