I changed the name of some scripts and now I get a warning message but scripts run fine

I changed the name of several C# scripts in my project. I made sure to change the class names in the file AND the name of the .cs files themselves to match. Running the project now works fine, but I get several console warnings logged saying “The referenced script on this Behaviour is missing!”.

Does anyone know how I might resolve this, or where I might look? Double-clicking on the warning does not do anything.

Thanks!

First, find the object where the component is missing. When you get this error, that means a component (such as a script) is missing and Unity cannot locate it. Once you find the object that is missing your script, delete that component and replace it with the script you want.

For example, let’s say that you had a PlayerController.cs script attached to your player object. Then you go and change that script to the name: PlayerMovement.cs. The player object will not contain a PlayerController.cs because it does not exist anymore. To fix that, go and click on the player object and add the new script. Your problem should be fixed.