- Home /
Fall down a line in Unity 4.6 text via script
Hello , Is there anyway to make the text go one line down in Unity 4.6's text component? using \n didn't work. Thanks
depends on what you are trying to achieve I am assu$$anonymous$$g that you are trying to write something in the text box and pressing enter to get next text in new line.
You can use multiple Text under one panel and have each Text represent one line
$$anonymous$$ay be you can post a screenshot of what you want and we may be clear about it
This is what i'm trying to achieve , the problem is that i want to only have 1 text box because each item will have a different description and thus different number of lines. Thanks.
Are you wanting a way to show the Uses: items one after another?
Are they stored in some sort of list or array?
An item is a scriptable object from the main class Item that has as children ItemConsumable etc... , Anyway , a Detail box has a script that when you pass an Item to it , it fills in those bars (title,type,description,volume and mass) , by passing "\n" in the description as a "go down one line" , it doesn't work.
Answer by Swati Patel · Jan 30, 2015 at 09:58 PM
I have also faced same problem regarding newline character(\n) but I have solved it. Instead of double quotes, pass \n in single quote like '\n'.
Answer by jgodfrey · Dec 29, 2014 at 11:23 PM
I'm not currently using 4.6 so I've never tried this, but...
According to the docs, the Text object has a "supportRichText" boolean property. If you set that to true, I'd expect some form of a new line escape sequence to be supported. So, either backslash-n, or backslash-r backslash-n, or even Environment.NewLine
Jeff
Well , Rich editing is for layout , Currently , i only can copy from an already written text :/
Answer by Mmmpies · Dec 30, 2014 at 08:59 AM
OK, I really think you'd be better having those items just as boolean values in your scriptable objects.
This will allow you to compare if that task or item increases a certain skill. It'll also allow you to run through the list of all items and compare that to the current item. If the item is wood, as in your example, then when it gets to Crafting it finds that it equals true, then it instantiates a prefab text with Text.text = " - " + SkillName.ToString();
EDIT: Ha - just got a text updating this as I add it!
If you have lots of skill type values then bool may not be viable but what's the maximum number of skill tags any one item cna have? You could have an Enum for you skill sets and then have say 5 slots available to add up to 5 skill type to each scriptable object.
There'll be hundreds of items and probably tens of types... I'll just settle with copying from an already written text.
Your answer
Follow this Question
Related Questions
GUIText Help 1 Answer
uGUI letter spacing and kerning 1 Answer
load line from a text file and separate it 4 Answers
How to turn on text in trigger zone 2 Answers