Search Unity

How do I create a text file in unity?

Discussion in 'Scripting' started by epiczed00, Nov 24, 2017.

  1. epiczed00

    epiczed00

    Joined:
    Nov 24, 2017
    Posts:
    1
    Hi, I wondering how I can create a text file in unity. This text file is .txt. I want to write something in the text through the c# script. and then I want to read the text file. I'm looking for this http://www.cplusplus.com/doc/tutorial/files/ , but in unity / c#. I'm trying to do a high score list where i put all the information in a text file. And I just wondering if you could help me find a way to create a text file. Because I work on mac and pc. but the problem is that mac have their own text format file. their name isn't .txt. it is something like .rtf. Thanks for taking your time. :) and have a good evening.
     
  2. hasanbayat

    hasanbayat

    Joined:
    Oct 18, 2016
    Posts:
    630
    Hi.

    Use File.WriteAllText and File.ReadAllText.

    Thanks.
     
    TaleOf4Gamers likes this.