"ObjectsHit.cs" Errors in Unity 2020.3.13

I’ve received an error in my “ObjectsHit” script for the obstacle course game in the Unity 3D course. This error only occurred after I added the If/Then statement for identifying the player in “Caching a Reference” I’m not sure how to fix it. What should I do?

The namespace ‘’ already contains a definition for ‘ObjectHit’ [Assembly-CSharp]
Type ‘ObjectHit’ already defines a member called ‘OnCollisionEnter’ with the same parameter types [Assembly-CSharp]

Hi,

Welcome to our community! :slight_smile:

Have you already tried to restart Unity and Visual Studio Code? And do you have a second file named ObjectHit in your Assets folder?

Thanks for having me! ^^

It was the second one. For some reason, it ended up making a copy of the script. Thanks for the help!

You’re welcome. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms