Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by isador34 · Jul 25, 2014 at 04:58 PM · guitextstring

[solved] print a multiline text in a GUI

hello all I have a great request, I have a script for read all line in a txt via a html adress, all the text was write in: public StringBuilder sb = new StringBuilder();

in my GUI I write this code:

 GUI.Label(new Rect(10, 10, 100, 20), reader.sb.ToString ());


but only the first line was print.

How to print multi line?

thanks you in advance

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image robertbu · Jul 25, 2014 at 04:59 PM 0
Share

$$anonymous$$ake sure the text has newlines to break the lines. Also you've made your GUI.Label() only 20 pixels high.

avatar image fafase · Jul 27, 2014 at 07:33 PM 0
Share

Solved but what solved it?

avatar image isador34 · Jul 28, 2014 at 12:06 PM 0
Share

the height on the GUI, I replace 20 by 200 and magic it's work

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Xtro · Jul 25, 2014 at 06:02 PM

Put '\n' into the string.

Ex :

"This is first line\nThis is second line"

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image isador34 · Jul 25, 2014 at 09:32 PM 0
Share

bug I read a text from http link so I can't modifie the value

avatar image Graham-Dunnett ♦♦ · Jul 25, 2014 at 09:34 PM 0
Share

You'll have to work out how to modify the text you get from the URL. $$anonymous$$aybe it has line endings which don't apply.

avatar image
0

Answer by isador34 · Jul 26, 2014 at 02:20 PM

in my txt file I write: 1\n2\n3\n4

But on my GUI same the \n was write...

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Xtro · Jul 26, 2014 at 02:28 PM 0
Share

Text files are encoded. C# strings are not. '\n' only work in strings. In a text file, you should press enter to make a new line and when you read/write this file to the screen it should break the line as expected. Ofcourse the platform you are writing onto must support multi-lines.

"GUI.Label" supports multi-lines. If your file has multiple lines, it should be working correctly.

Do you wanna attach the text file here ?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How do i take a string from a gui and show it in the gameworld c# 1 Answer

Problem with makeing text appear on screen 0 Answers

IF in a GUI 2 Answers

Detect Text in GUI; Print 1 Answer

format text block in GUI.Box 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges