Unity 5 Accessing other scripts problem

Since I upgraded my unity from 4 to 5 I keep getting errors I never did before. Here’s the error I get when I try to access other scripts:

The name ‘DoorKey’ does not denote a valid type (‘not found’).

Here’s the script I used:

#pragma strict

var key : DoorKey = GetComponent(DoorKey);
var block : GameObject;

function Start () {


function Update () {
	if(key.door == gameObject) {
		if(key.taken) {

I also tried using different versions such as:

var key : DoorKey = GetComponent("Door Key");
var key : DoorKey = GetComponent.<DoorKey>();

And even tried changing the DoorKey to a GameObject but still…

var key : GameObject = GetComponent(DoorKey);

Why does this happed?

You have to reference to component in function using variable and get component from it.

var key : DoorKey;
var block : GameObject;

function Awake ()
   key = GetComponent.<DoorKey> ();

[rest of code...]

Also make sure that ‘key’ and ‘taken’ variables are public.

Found the problem. The script’s name was “Door Key.js”. I removed the spaces(“DoorKey.js”) and everything worked fine! Thanks tho