Error CS0101 in C#

Started coding a door script for an animation that happens when the door’s box collider is triggered. I figured I would watch a tutorial video on it (it was this video: Unity Open Door Script C# - YouTube) and follow along since I did not know how to do it initially. Turns out, I did not do it right, and even looking through and copying EXACTLY what the video stated, I still got an error message. Here is the code that I wrote:

public class Door : MonoBehaviour {

private Animator _animator;

// Use this for initialization
void Start () {
    _animator = GetComponent<Animator>();
}

void OnTriggerEnter(Collider other)
{
    if(other.tag == "Player")
    {
        GetComponent<Animator>().SetBool("Open", true);
    } 
  
  }
}

This code is producing the error: Door.cs(1,10): error CS0101: The namespace ‘global::’ already contains a definition for ‘Door’

I have no idea what this means. If somebody could potentially figure out this error (since I cannot go into play mode until this is solved) or maybe give me a new video that might not produce this error, then I would be very grateful.

Hello man,

Maybe there is already some NameSpace(in some script) in your all project called “Door”, and that causing some conflict with your script. I saw the video and he created the script with name “DoorScript” instead “Door” as you did. Try to change your script’s name to “DoorScript” or something that isn’t “Door”. Maybe it works :x