Components all of a sudden becoming null references

This problem is really eating at my patience, and at this point I’m at a loss.
For some game objects, I put a reference to their script in the controller I’m using to manipulate those instances because it dramatically reduces the amount of code needed to do method calls.

I always do it like this:

private Script reference;

void Start()

      reference = GameObject.FindGameObjectWithTag ("Object").GetComponent<Script> ();


public void DoStuff() 

     reference.DoALotOfStuffWithOutAllTheAnnoyingExtraCode(foo, bar);


And this works, most of the time. But all of a sudden I start getting thrown NullReferenceExceptions in my face from some of these method calls. Sometimes only from certain clones of a prefab! Sometimes, the fix for this is restarting Unity.
Other times, I have to add checks if a reference is null before the method calls, even though I have checked again and again that I have all the syntax correct when I assign the reference in the first place.

An actual example from working code:

I have rooms with four doors leading out from them, each door having three states being open, locked or blocked/hidden.
The door itself has two animations, one for opening and one for closing(when the door is hidden, it’s taken care of by the actual door controller by disabling the renderers of the different parts).
In this case, the animator is the perpetrator:

using UnityEngine;
using System.Collections;

public class DoorAnimation : MonoBehaviour {

	private Animator anim;
	void Start () {
		anim = GetComponent<Animator>();
	public void CloseDoor() {

		if (anim == null) {
			anim = GetComponent<Animator>();   
        anim.SetBool ("Open", false);

	public void OpenDoor() {
		renderer.enabled = true;

		if (anim == null) {
			anim = GetComponent<Animator>();   

		anim.SetBool ("Open", true);


This is the ONLY way I can make this work.

Has anyone else experienced this?

And by the way, I’m running Unity 4.3.4 on OSX.

I think it is because the component is not ready at the time GetComponent is used in Start()
The reference is therefor null.

Adding Awake() (even if empty) on the script on the component you want reference of, and setting the reference variable in Start() on the script you want reference in.

If you do not set the reference variable as private, you can see it in the inspector while debugging. Makes it easier to see what is set or not.

Also if one script is C# and another is UnityScript, I think you may get null reference.

Adding links about what to do with null reference problems, more in a hope that more reads them so we can reduce the amount of questions regarding them.