How to refresh a TXT file of my project
Im developing an App fo android and I need to save and load files using TXT. But after I save the files in the TXT I have an option to read all the files, but some of then are not being refreshed. So I tried to look for a solution to this problem and I found a question here that is almost the same thing, but the question was made in 2013 and I don't know if the sintaxe is the same. I read about something called Asset.DataBase.Refresh, it
s seeing to be exactly what I need, but I tried and mono said that Asset.DataBase.Refresh doesn`t exist. I`m using unity 5.0.1 and I tried to read at the unity`s manual and the example there was not clear for me and I couldn`t find a solution to my problem.
So I`m saving everything in Resources folder, and to load the TXT files I using Resource.Load and I stored the files in TextAssests. Everything is going OK, and after saving the files I have the option to read all the files, but some of the are old, and wasn`t updated, if I go to the apps folder and look for the new TXT it`s up to date, and if I go back to the App and select the option to read files again, the app write everything OK with the files up to date. So I need Unity to refresh the files to write the newer TXT files.
Hope you guys can help me!
Thanks!
Answer by vintar · Jan 03, 2016 at 09:12 PM
the method is AssetDatabase.Refresh . Check here http://docs.unity3d.com/ScriptReference/AssetDatabase.Refresh.html
but how does it work? Can you give me a piece of code just to understand how it works? $$anonymous$$y doubt is how the syntaxe is.
thanks for the quickly reply!
$$anonymous$$aybe this shows it better : http://docs.unity3d.com/$$anonymous$$anual/AssetDatabase.html
Answer by ClementHo · Jul 21, 2016 at 07:24 AM
i hope this helps: you need to type "using UnityEditor;" at the top of the c# script. and then call " AssetDatabase.Refresh(); " wherever u need.
i was also trying to figure it out.
But, if i want refresh on moblie device. There is somthing like UnityEditor but for smartphone?
Your answer
![](https://koobas.hobune.stream/wayback/20220612054820im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can anyone tell me what the issue is with my code? (C#) 1 Answer
TextMeshPro Dropdown RefreshValue not working 0 Answers
How to refresh/reload all C# scripts in project? 1 Answer
Editor Ram Usage Skyrockets upon refresh, decreases later on 0 Answers
Can I RenderSettings script are refresh setting by Reloaded Scene? 0 Answers