Search Unity

Setting a max size for a content size fitte

Discussion in 'UGUI & TextMesh Pro' started by ElChileVengador, Jul 10, 2021.

  1. ElChileVengador

    ElChileVengador

    Joined:
    Feb 4, 2013
    Posts:
    27
    Dear Unity forums,

    I'm have a problem which I'm sure has a simple solution but I haven't been able to figure out. I've created a tooltip that uses a textMeshProUGUI and a panel element inside. I'm using a horizontal layout group + Content size fitter to keep the panel surrounding the text object to a constrained size.

    However, while this works great to keep the width of the panel to the size of the text, I'd like to set a maximum width, so that if the text is too long, it will jump line as opposed to cover the whole screen. What would be the best way to do this?

    Cheers,
    Rafa