How i can make a Dialogue Box?

guys i have this dialogue box who is really little, but i want it to expand automatically when there is to much text, how i can do it?

1 Like

  1. Don’t set a condition so that it can be constantly updated.
  2. Set size equal to the size of the text object and add a little extra so there is some space between the edge of the sprite and the text. + 30 should be good.
  3. Position the dialogue box where the txt is, minus half of the additional size so that the text will sit in the middle.
1 Like

Thank you, but if i want to do this with a 9 patch object?

Did you try? Should work the same.

1 Like

Make sure z order is correct.
Make sure both objects are on the scene.

1 Like

Yes i tried and it shows like this:

How i can fix it?

Could I see your events sheet and yarn node?

Windows Log Key + S

or type in snipping tool and use that.

To be honest I don’t have a Yarn node, for the text i am using Arrays, and these are the full events of the scene, if you want i am even online on discord

What do you mean by snapping tool?

Guess how I got this image? Things are getting meta here.

Ohhh, ok ok, ye in my country we call it just “Cattura” that’s why i didn’t recognize the name. Btw i sent you everything

At beginning of scene change z pos of dialogue box to KateBiraText.Zorder() -1 or maybe it’s just KateBiraText.Z - 1

Tried, Nothing changed, imo is not a problem of Z order but how the text size change

Ok, I’m sorry I couldn’t help

TheQuirkyGamer gave a good way to do what you want. But you have to keep in mind that you are using a panel sprite with fairly large margins and default size.

Panel sprites can break and look terrible when you size them smaller than their default size.

A text box, if you laid it out in the editor and don’t resize it in game with events, will always be the width you made it in the editor. But the text box height will always only be equal to how high it has to be to fit the lines of text you gave it.

So right now you are asking a 320 pixel height panel sprite to scrunch itself down to fit a much smaller height (most of the time) text box. Of course it looks awful.

Here I have a 128 x 140 default size panel sprite with margin of 56 all around.


The width I want to match my custom width text box (plus margin x 2) so I can set that up in a beginning of scene event and leave it alone

I want the height the size of my text box (+ margin x 2) unless the text box is so much smaller than the default size of the panel sprite that it would break it.

I want the position to overlap all edges of the text box, so text box position - margin.

Here are some events for it

I can get away with using the bounding boxes for condition to resize because I gave it very large padding and it will never get so smaller than default that it breaks. If you would like less padding so the box around the text is smaller, just play around with how much padding you give in your events. As a condition to resizing, make sure it won’t resize under 320 (or maybe a little smaller depending on your panel sprite, see how short you can make it in the editor before it starts breaking.).