unity cant add script component

Here are links to screen shots of the issue:


I have triple checked that the names match exactly and no compiler errors are popping up in unity. Thanks for any advice!

Save the file before you add it.

There’s an asterix (*) next to the file name in the window title at the top which means the file has changes not saved to disk. I could imagine you created a new script that had the name NewMonoBehaviour, then you renamed the file, opened it and started writing code but forgot to save.

There are a number of things you could try to do:

1. Copy the code, delete that script, and create a new one then paste it.

2. Right click the project window, and select sync mono project.

3. Restart unity.