Page 1 of 1

Layout/size for inline, async-loaded textures

Posted: 26 Nov 2024, 19:30
by oraccuglia
Hi, I'm having trouble getting images to work inline with text when that image has to be loaded asynchronously in Unity. I can reproduce the problem with a text block like this:
<TextBlock>
    <Run>Prefix Text</Run>
    <InlineUIContainer>
        <Image Source="{Binding Image}" />
    </InlineUIContainer>
    <Run>Suffix Text</Run>
</TextBlock>
...where `Image` binds to a `UnityEngine.Texture` that's not immediately provided.

The result is the two text elements next to each other; the GUI inspector resource adorner shows the image outside the visible area of the text:
inline-image-1.png
inline-image-1.png (9.65 KiB) Viewed 4956 times
If the text has a hover style change (e.g. changing `TextBlock.Foreground` to a new brush), the image takes up space, but the overall layout doesn't react to the space taken up (and the suffix text is cut off, in a way it wouldn't be if I put in a much longer message with no images).
inline-image-2.png
inline-image-2.png (7.53 KiB) Viewed 4956 times
My overall goal is to support controller input hints in localized text; my implementation is built alongside Noesis' RichText bbcode tags, which is why I'm dealing with images and inline text blocks - and threading constraints mean I need to supply the image asynchronously. Is there something I could do differently to get the size/layout to propagate right?

Re: Layout/size for inline, async-loaded textures

Posted: 28 Nov 2024, 10:19
by sfernandez
Hello, I was able to reproduce your issue, when the image is set the TextBlock is not correctly invalidated and measured again.
Could you please report it in our bugtracker?

Re: Layout/size for inline, async-loaded textures

Posted: 11 Dec 2024, 12:30
by sfernandez
We fixed this issue for the next 3.2.7 version.