Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- File.WriteAllText(Path.Combine(_directoryPath, fileName), _text, System.Text.Encoding.ASCII);
- #if PLATFORM_ANDROID && !UNITY_EDITOR
- TextAsset textAsset = new TextAsset(System.IO.File.ReadAllText(filePathAndName));
- #elif UNITY_EDITOR
- TextAsset textAsset = AssetDatabase.LoadAssetAtPath<TextAsset>(filePathAndName);
- #endif
- #if PLATFORM_ANDROID && !UNITY_EDITOR
- SavedTextsCompleteFilePath = Application.persistentDataPath;
- // just for debugging and playing in the editor
- #elif UNITY_EDITOR
- SavedTextsCompleteFilePath = "Assets/Resources";
- #endif
- // set the base file path, then add the directory if it's not there yet
- SavedTextsCompleteFilePath = MakeFolder(SavedTextsCompleteFilePath, "MyGameSaveFolder");
- }
- private string MakeFolder(string path, string savedTextsFolder)
- {
- string saveDirectory = path + savedTextsFolder;
- if (!Directory.Exists(saveDirectory))
- {
- Directory.CreateDirectory(saveDirectory);
- Debug.Log("directory created! at: " + path);
- }
- return saveDirectory;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement