How on earth do i fix this error i keep getting

I have an error but don’t know how to fix it. It’s this error Assets\Scripts\PlayerMotor.cs(5,14): error CS0101: The namespace ‘’ already contains a definition for ‘PlayerMotor’.
This is my script.

It means you have two scripts called PlayerMotor in your project. You can’t have two types with the same name within the same namespace.

Also your Visual Studio is not set up correctly. I would look into fixing that.

1 Like

I don’t have two files and how would I fix it?

The compiler doesn’t lie. There’s two definitions for PlayerMotor somewhere in your project. You’ll need to do a proper search.

And easiest way would be to just ensure the following is set up: Unity - Manual: Visual Studio C# integration

It doesn’t have to be two files. It could be two of anything in your code defined with the name ‘PlayerMotor’ in the same namespace. If you’ve got any 3rd party stuff in your project, such as downloaded examples or stuff from the Asset Store, it could be in those, too.

2 Likes