Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

InputField (multi line Newline)- read lines to list

Discussion in 'Scripting' started by cicha09, Mar 5, 2018.

  1. cicha09

    cicha09

    Joined:
    Aug 6, 2015
    Posts:
    7
    Hello,
    I would like read lines from input field to list or array.


    I can read only single chars or all text.
    I have been thinking about checking when user press Enter and then add some char (like "_"). Then split by this char to make it easy.

    My question is:
    Is there a better solution?
     
    Last edited: Mar 5, 2018
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    If the inputfield has multiple lines, I would try splitting by '\n' or Environment.NewLine (as opposed to your own insertion of '_').
     
    cicha09 likes this.
  3. cicha09

    cicha09

    Joined:
    Aug 6, 2015
    Posts:
    7
    Thanks, it works!