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: https://www.youtube.com/watch?v=iKWJBgFCDWU) 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();
}
void OnTriggerEnter(Collider other)
{
if(other.tag == "Player")
{
GetComponent().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.
↧