Forum rules - please read before posting.

Resizing inventory boxes at runtime

I was just wondering if there is a way to resize the inventory boxes at runtime to suit the text length. I have three inventories in my scene and I just show up text not an image but My menu inventory boxes I need to show them in a scene and they are all the same size and don't shrink or extend according to the words. This image may explain better.
It really doesn't matter but if there was a way to shrink the box if the word was like 3 letters or expand the box if the word was much larger. If adventure creator has that feature it would be great but if it doesn't it would be great if it was added. This is a Hidden object game with HOG Art Pack and I have finished 1 scene with all features such as particles and the hint system and animations.

Comments

  • It can be done so long as your Menu relies on Unity UI (see this tutorial for converting an AC Menu).

    Unity UI has a bunch of "Content Size Fitter" / "Layout Group" components that can be used to dynamically resize elements based on their contents.  It is something of a dark art getting them to work exactly, but you should be able to find the correct workflow by searching the Unity forums.
  • The content size fitter works with text but I can't get it to work with a button. As you see in the image it just stretches the button and doesn't resize it to fit with the text. There isn't that much info on the internet for this either.
  • What type of component it's attached to - Button, Text, etc shouldn't matter.  Try adding a Content Size Fitter (Horizontal Fit: Unconstrained, Vertical Fit: Preferred Size) and a Vertical Layout Group (with all child toggles checked) to the Button, and make sure the Text is a child component.

    If that doesn't help, I apologise - but this is a Unity UI issue and not directly AC related.
  • It is a button but that still doesn't work because when I put preferred size on the content size fitter it just makes my button shape change really bad. I think I will ask at the UI forums thanks for your help any way.
  • Fixed it now I had simple instead of sliced on the button now I can move on to the next scene.
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.