Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void CreateNewFile (string fileName) {
- File.Create (Application.streamingAssetsPath + "/" + fileName + ".lua"); //creates a new file
- }
- public void DeleteFile (int index) {
- //Debug.Log (index);
- File.Delete (Application.streamingAssetsPath + "/" + files[index].EditButton.transform.GetChild (0).GetComponent<Text> ().text + ".lua"); //deletes the .lua file
- File.Delete (Application.streamingAssetsPath + "/" + files[index].EditButton.transform.GetChild (0).GetComponent<Text> ().text + ".meta"); //deletes the accompanying .meta file
- foreach (Transform child in contentArea) {
- if (child != contentArea.GetChild(0)) {
- GameObject.Destroy (child.gameObject); //destroys the UI elements that point to files
- }
- }
- currentList.Clear (); //clearing these two lists allows the remaining files in the streaming assets folder to be regenerated in the UI after clearing all elements, with correctly ordered file id's.
- files.Clear ();
- }
Advertisement
Add Comment
Please, Sign In to add comment