- Home /
Why can't Unity see my file
I am new to Unity and I might be doing something stupid, but I can't figure out why Unity says that this text file doesn't exist. The text file is called "SaveFile.txt" and I put it in this path: "C:/Users/Joey/Desktop/Unity Games/Breakthrough/Assets/Saves/SaveFile.txt" This is the same path that is displayed in the console when I run the code, so i don't understand how it can't find the file.
using UnityEngine; using UnityEngine.UI; using System.IO;
public class MenuScript : MonoBehaviour {
public string filePath;
void Start ()
{
filePath = Application.dataPath + "/Saves/SaveFile.txt";
Debug.Log(filePath);
if (!File.Exists(filePath))
{
Debug.Log("doesn't exist");
}
}
Answer by Kishotta · Apr 22, 2017 at 08:28 PM
Have you checked the properties of the text file? The meta file implies that the name might be "SaveFile.txt".txt
As @$$anonymous$$ishotta said you file name is "SaveFile.txt.txt" change your Windows Explorer to don't hide know extensions.
@$$anonymous$$ishotta @Sergio7888 Thank you for the help. The file was saved as "SaveFile.txt.txt" I changed the name and Unity can see the file.
Your answer
![](https://koobas.hobune.stream/wayback/20220612120356im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is there a way to save a 2D characters path and replay it on respawn? 0 Answers
Saving or Reading text file works on Mac but not on iOS 1 Answer
Unity pathfinding - Comparing 2 paths? 2 Answers
Save / loading game data 0 Answers
Is it a good idea to save game data in a multidimentional array? 1 Answer