Search Unity

String text alignment

Discussion in 'Getting Started' started by heipp123, Oct 1, 2015.

  1. heipp123

    heipp123

    Joined:
    Aug 1, 2015
    Posts:
    8
    hi
    guys
    how do i alignment one to right and another to left side.

    Code (CSharp):
    1. highscoreFields[i].text += highscoreList[i].username + "  " + highscoreList[i].score;
    now its look like this

    but i want it like this



    thanks.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    You use two separate texts (one left-aligned, one right-aligned).
     
  3. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    They'd have to be two separate text objects for you to align them differently.

    Edit: Joe the ninja.
     
    JoeStrout likes this.
  4. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    557
    Two text objects is the way to go, imho. You could also use one field, set a maximum length, and then pad the middle with spaces....but that is a lot of work.
     
  5. heipp123

    heipp123

    Joined:
    Aug 1, 2015
    Posts:
    8
    thanks you all.