|
Post by Power Supersport on Sept 12, 2015 17:14:17 GMT
Guys, I didn't tell you that, but I moved to Unity for many reasons that I don't want to describe right now...
So... What I need is the functions iFileRead() etc and iFileWrite() that we all know very well in 3D Rad...
Is here someone who can tell me how can I read a text file in Unity 3D? Of course, scripted way... Thank you in advance... BTW... Geometry dash 3D will continue it's development, but in Unity... Expect mobile (Android) versions...
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 12, 2015 17:43:20 GMT
|
|
|
Post by Power Supersport on Sept 12, 2015 18:22:14 GMT
Ahaa... so I import System.IO in order to work... that's why it didn't thank you for your spent time...
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 12, 2015 18:40:21 GMT
not much time spent on this, unity has a lot of tutorials just one google search away, it feels good when there are so many resources
|
|
|
Post by F1Andre on Sept 12, 2015 19:24:38 GMT
Use stream reader and stream writer like this.
Void Awake() { StreamWriter writetext = new StreamWriter("write.txt"); writetext.WriteLine("hello"); writetext.WriteLine("Power"); writetext.Close();
StreamReader readText = new StreamReader("write.txt"); String readmetext01 = readText.ReadLine(); String readmetext02 = readText.ReadLine(); readText.Close(); Well thats the basics, just read the documentation on the MSN website on streamreader and writer.
|
|
|
Post by Power Supersport on Sept 12, 2015 19:53:52 GMT
Thank you! Thank you very much, Andre! That's exactly what I expected! It's so clear that I am absolutely sure that I can imlpement that thing into my game! Thank you again... both of you!
|
|
|
Post by F1Andre on Sept 13, 2015 7:02:19 GMT
My pleasure. Just remember to encrypt your files. I'm not talking about that function that automatically encrypts it, as it has its limitations. Just write a simple few line encryptor.
|
|
|
Post by Power Supersport on Sept 13, 2015 7:13:46 GMT
Encryption? I've never though about that... but probably the best will be first to implement the reading / writing system properly and then most of the objects... encrypting may wait for now...
Wow... there are so much stuff to learn from Unity...
|
|
|
Post by F1Andre on Sept 13, 2015 7:51:43 GMT
There is actually a better way to handle saving and it's called serialisation. It's much better and try to avoid using .txt files when saving data like scores and player names. But I know what you are trying to do and .txt files works better for that.
If you read about serialisation somewhere don't doubt yourselve. There is nothing wrong with text files. It's quite funny actually because even big time developers use text files.
|
|
|
Post by Power Supersport on Sept 13, 2015 20:04:03 GMT
Because the levels should be downloadable and editable... that's why I want to make them text files...
And... maybe I will read more about serialisation later...
|
|