0
\$\begingroup\$

I am working on my project since morning , when i open my project later after work unity show me following error:

Assets\Main\Script\SettingScript.cs(1,1): error CS1056: Unexpected character '

To solve this problem i open my script and visual studio didn't open it and it show following error:

The document's format is either unsupported or the document contains binary characters, opening with a different application.

and vs open notepad but notepad is empty it doesn't show code neither on vscode.

This what it look like when i open script with HxD and sublime text editor

:

How can i fix this error?

Edited: I have solved my issue by updating my old script from my old backup but still need help for what is the cause of corrupted file

\$\endgroup\$
7
  • 2
    \$\begingroup\$ This file looks seriously corrupted. I don't think you can recover anything useful here. What's the original source for this file? You may need to re-download it from the source or re-make it from scratch. \$\endgroup\$
    – DMGregory
    Jul 25 at 19:43
  • \$\begingroup\$ Try some different apps to open it as a text file and see if you can find the cause. Though I highly doubt you can recover it \$\endgroup\$
    – Arian_ki
    Jul 25 at 20:16
  • \$\begingroup\$ You may also want to check whether your drive has space free — in the past I've gotten an empty file like this when trying to download or save a file with no space left on the drive, so it got an entry in the file system index, but no contents were actually stored. \$\endgroup\$
    – DMGregory
    Jul 25 at 20:18
  • 1
    \$\begingroup\$ Filecorruption can happen for multiple reasons. The main reasons usually are either your hard drive is dying or an unexpected shutdown of OS while file is open/ system crash \$\endgroup\$
    – Zibelas
    Jul 26 at 8:43
  • 1
    \$\begingroup\$ "How do files get corrupted" is not a question about how to develop a game, so it's not on-topic for this site. It's a question about how to work with your computer's OS, possibly better-suited to Super User. \$\endgroup\$
    – DMGregory
    Jul 26 at 11:13

0

You must log in to answer this question.

Browse other questions tagged .