Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Breaking line in text component

Discussion in 'Project Tiny' started by TrashestCoder, Jan 24, 2019.

  1. TrashestCoder

    TrashestCoder

    Joined:
    Jan 27, 2017
    Posts:
    14
    So I have simple UI text component
    upload_2019-1-24_17-42-16.png

    whose text I access through this script:
    upload_2019-1-24_17-49-37.png

    But when I load up project using chrome, text is displayed in one line instead of breaking into two parts:
    upload_2019-1-24_18-2-30.png
    I as well tried combinations like ``; but that as well didn't work. Maybe someone encountered this problem and know how to solve it?
     
  2. tomny

    tomny

    Joined:
    Sep 12, 2015
    Posts:
    16
    I had the same problem. I don't think Tiny supports multiline texts (Correct me if I'm wrong).
    I just had two text fields for my question and set each like so

    Code (JavaScript):
    1. let qt1 = this.world.getComponentData(this.world.getEntityByName("QuestionText1"), ut.Text.Text2DRenderer);
    2. let qt2 = this.world.getComponentData(this.world.getEntityByName("QuestionText2"), ut.Text.Text2DRenderer);
    3. qt1.text = "What is your";
    4. qt2.text = "favorite color?";
    5. // set comp data
     
  3. TrashestCoder

    TrashestCoder

    Joined:
    Jan 27, 2017
    Posts:
    14
    Ha, thanks for the solution. It will fit just right with my moving buttons 100 miles away from camera, because I couldn't disable them.
     
  4. SzabolcsNagy

    SzabolcsNagy

    Joined:
    Jan 28, 2019
    Posts:
    3
    In the editor window it shows up correctly, though.
    When playing the game it shows "Line Brea" on one line... :(
    upload_2019-2-25_13-27-32.png
     
  5. Deleted User

    Deleted User

    Guest

    I had this problem too.
    Unfortunate, the only solution i found, was the same as Tomny said.

    Sad :(
     
  6. xenoph

    xenoph

    Joined:
    Oct 28, 2016
    Posts:
    2
    Multi-line text label support is on the roadmap it seems.
     
    ER_Dolleman likes this.
  7. sahilverma5

    sahilverma5

    Joined:
    Mar 1, 2019
    Posts:
    5
    Having Same issue ....
    Multi Line is not working. Please, provide a solution to show text in multiple lines
     
  8. gattzack

    gattzack

    Joined:
    May 21, 2017
    Posts:
    13
    I tried using this method but nothing comes up, also this error is shown in the console :
    "ut.World.getComponentData(): Invalid entity NONE when attempting to get component ut.Text.Text2DRenderer (Component ID 8) ut.World.getComponentData(): Invalid entity NONE when attempting to get component ut.Text.Text2DRenderer (Component ID 8) "
    Any ideas as to why this is happening please?
     
  9. Zionisias

    Zionisias

    Joined:
    Apr 23, 2019
    Posts:
    40
    You get that error whenever the entity you are feeding into the this.world.getComponentData does contain an empty entity reference (Index and version both 0, this is called the NONE entity by Unity Tiny. See it as a null-value for entities.). There can be multiple reasons why your entity refers to the NONE-entity. If you are doing the same as in the example provided above: this.world.getEntityByName() will return the NONE-entity whenever the provided entity name does not match an existing entity.

    If this doesn't help you, you could provide a code sample so I can determine why your entity is the NONE-entity. ;)