Forum rules - please read before posting.

Menu background texture expanding the longer the text is

Hey guys,
I have a menu that basically pops up to explain to the player what to do next, the label is a global variable. However, I'd like the background for that label to expand depending on how long the string is. For example if I just put in a graphic and then put the variable in front of it, some shorter strings might work, but some longer strings might overlap the graphic box and obviously not fit into it. If I just made a really long graphic then the shorter strings would just have a huge background graphic that looks empty.

So if I had a huge string then the graphic would expand to fit the text into it, or if the text was short then the graphic would be shorter too.

Do you have any idea how I could do this? 

Thank you! :)

Comments

  • If you have your menu rely on Unity UI, you can make use of Unity's provided Content Size Fitter etc components to get this behaviour.

    Connecting the Menu Manager to a Unity UI canvas is covered in this tutorial.  Once the connection is made, actually getting the resizing effect will be down to Unity UI, but a search of Unity's docs / google can get some advice on that quite readily.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.