Search Unity

Question Scroll element. content centered if smaller than view but anchored in a side otherwise

Discussion in 'UGUI & TextMesh Pro' started by Divinorium, Jun 28, 2020.

  1. Divinorium

    Divinorium

    Joined:
    Feb 4, 2014
    Posts:
    15
    As the title implies, I am trying to make the content start centered if it is smaller than the view but make it anchor in a side if the content is bigger than the view.

    My content is a text mesh pro element that gets information from items and characters, sometimes the item name/description is smaller than the view, so i want it to be centered, others times it is bigger and i want it to start in one of the sides.

    Like in the, ugly, drawing below.


    what i want.png

    Anyone has any idea how to do it?(I have messed with anchors and i can change where it starts, but apparently not on the fly.)