oraccuglia
Topic Author
Posts: 1
Joined: 26 Nov 2024, 17:40

Layout/size for inline, async-loaded textures

26 Nov 2024, 19:30

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 4950 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 4950 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?
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

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

28 Nov 2024, 10:19

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?
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

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

11 Dec 2024, 12:30

We fixed this issue for the next 3.2.7 version.

Who is online

Users browsing this forum: No registered users and 5 guests