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 Jojo B · Apr 13, 2014 at 12:08 PM · texthousereading

Reading data from text can't get new line

hey so ime trying to read data from some text specificly ive got a plan for a house it looks like this

w= wood

c = carpet

t = tile

[Floor]

, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w,L

, c, c, c, c, c, w, w, c, c, c, c, c, t, t, t,L

, c, c, c, c, c, w, w, c, c, c, c, c, t, t, t,L

, c, c, c, c, c, w, w, c, c, c, c, c, t, t, t,L

, c, c, c, c, c, w, w, c, c, c, c, c, t, t, t,L

, c, c, c, c, c, w, w, c, c, c, c, c, t, t, t,L

, c, c, c, c, c, w, w, c, c, c, c, c, t, t, t,L

, c, c, c, c, c, w, w, c, c, c, c, c, t, t, t,L

, c, c, c, c, c, w, w, c, c, c, c, c, t, t, t,L

, c, c, c, c, c, w, w, c, c, c, c, c, t, t, t,L

but currently when i tell my code to loop back round if it ends a line so basically where theirs an L

it doesn't i think its possibly the enter after the L but ive tried compensating for it and its just not working so hears my code (its near the bottom)

 public class BuildHouse : MonoBehaviour {
     public int StartX = 0;
     public int StartZ = 0;
     public int StartY = 0;
     
     public Chunk ChunkData;
     public TextAsset HouseFile;
     
     public string Curent = "floor";
     
     // Use this for initialization
     void Start () {
         
     }
     
     // Update is called once per frame
     void Update () {
     
     }
     
     public void Build (){
         int X = StartX;
         int Z = StartZ;
         int Y = StartY;
         string[] data = HouseFile.text.Split(',');
         //print(data.Length); 
         foreach (string symbol in data){
             print(symbol);
             if (symbol == "[Objects]"){Curent = "Objects";}
             if (symbol == "[Walls]"){Curent = "Walls";}
             if (symbol == "[Floor]"){Curent = "Floor";}
             
             if (Curent == "floor"){
                 
                 if (symbol == " w"){ ChunkData.map[X,Y,Z].FloorID = 1;
                 print ("XYZ");}
                 if (symbol == " c"){ ChunkData.map[X,Y,Z].FloorID = 2;}
                 if (symbol == " t"){ ChunkData.map[X,Y,Z].FloorID = 3;}
                 ChunkData.UpdateTile(X,Y,Z);
             }
             
             X += 1;
             if (symbol == "L/n"){ //<-----this is tell it to start a new line
                 print ("123");
                 Z += 1;
                 X = StartX;
             }
             if (symbol == "[NewLevel]"){Y += 1;}
             
         }
     }
 }

any help much aprechiated

Comment
Add comment · Show 2
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 Jojo B · Apr 13, 2014 at 06:46 PM 0
Share

no one realy??

avatar image Julien-Lynge · Apr 13, 2014 at 07:57 PM 0
Share

@Jojo, it's not wise to complain if you don't get an immediate response from people that are helping the community out of the goodness of their heart. It comes across as entitled.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Julien-Lynge · Apr 13, 2014 at 07:59 PM

@Jojo, I have a little trouble understanding what you're trying to say. You say "it's just not working" - what, exactly, is happening, and what do you expect to happen?

Looking at your code, what jumps out at me immediately is '/n' - this is not a newline character, '\\n' is. '\\' is the escape character.

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 Jojo B · Apr 13, 2014 at 08:04 PM 0
Share

ye i hive put /n but it doseent seam to register it when it goes through the if statment

avatar image Jojo B · Apr 13, 2014 at 08:33 PM 0
Share

o ok sory my bad wrong slash k thanks

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

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Gui text script - help 1 Answer

Reading & Writing to text file After building for iPhone. 2 Answers

House rendering problems? 0 Answers

I need help with my GUI text for my Real Time Strategy Game 0 Answers

How to read the format "Key: Value" 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