Got a weird editor issue with C# scripts: They won't open correctly


I’m not sure if this is a common issue of just something with my computer, but I am using Unity 5.3.4 and whenever I create a new C# script, the little icon next to the name is blank white and has no C# icon on it. In addition to this, these new scripts don’t open in Visual Studio Community and open in Notepad only. At the end of the scripts’ file directory name, instead of NewBehaviourScript.cs for example, they say NewBehaviourScript.cs - Copy. Does anyone know how to fix this annoying bug? Or have I done something by accident that caused this?

You’ve kind of answered your own question.

There is a numbering and naming convention used for the template files in directory

In your case, template 81 used for C# scripts has the “-Copy” suffix and so each new script file created will have that suffix attached. As such, it will not be recognised as a C# file, which needs to end as filetype .cs.

  1. Within that template directory, ensure the template is named as:

81-C# Script-NewBehaviourScript.cs.txt

This will correct for any scripts going forward.

  1. For your existing project scripts, locate the directory under Assets containing the generated script files and rename any containing the suffix “-Copy” by removing that suffix and simply having “.cs” as the filetype.