How to rename a script?

I have a script but I want to change its name. However

  • If I change it in Project tab (Unity) it gets a complete mess in my project.
  • The other way is to delete the script and create a new one, but it takes time and later I have to attach it again to every GO it is attached to…
  • Open the script in Visual Studio
  • Select the script’s name
  • Ctrl + R twice (Rename)
  • Check “Rename file” box
  • Change the script’s name
  • Click on “apply”

The script’s name will be changed not only in the script but also in its file in the computer.
The name will change automatically when saving the script and returning to Unity.

This change will be applied to all the references in the editor too.