Skip to content

Commit 5e56bcb

Browse files
committed
fix: checking if the old save file exists
when we open the game in a different scene in the first time (when we don't start the game in the Initialization scene), the error is raised.
1 parent 4f5a162 commit 5e56bcb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

UOP1_Project/Assets/Scripts/SaveSystem/FileManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ public static bool MoveFile(string fileName, string newFileName)
4848
{
4949
File.Delete(newFullPath);
5050
}
51+
52+
if (!File.Exists(fullPath))
53+
{
54+
return false;
55+
}
56+
5157
File.Move(fullPath, newFullPath);
5258
}
5359
catch (Exception e)

0 commit comments

Comments
 (0)