Deborah Douglas (choyce7)

2 answers · asked · Lesson: Rocketship Movement · Course: Create a Rocketship Video Game in Unity

I am getting an error when attempting to add the script.

"Can't add script component 'Rocketship' because the script class cannot be found.  Make sure that there are no compile errors and that the file name and class name match."  I have attached an image of my code.  

  • I had a couple of typos in here and didn't realize it. It is working now!
  • crew

    Great! Just to clarify what the error was for anyone else who runs into this. The reason you get that error is because the class name and the file name do not match. These are case sensitive. So if you created the script file and called it "rocketship" and the class name was Rocketship, they would be seen as two separate files and the class would basically not be referenced anywhere. Most of the time this happens initially when you accidentally hit enter before you change the name of the file upon creating it.