NullReferenceExeption ().bounds

Hello there
I get a Null Reference Exeption for the second line of this code. I googled what this means and I guess I get what it means but somehow not. Does it mean, that my target has no bounds or something like that?
It’s a code snippet from a tutorial.

 void LateUpdate () {
		Vector2 focusPosition = focusArea.centre + Vector2.up * verticalOffset;
		transform.position =(Vector3) focusPosition + Vector3.forward * -10;


Thanks for the help.

@fabian_rensch, as I see it there are three possible causes for the exception:

  1. focusArea is null
  2. target is null
  3. The result of target.GetComponent<Collider2D>() is null

You can very easy test these three cases using if statements.


Seems like target is Null. I expected that somehow but no clue how to fix that.

    Debug.Log ("It's targets fault") 

My target was initialized here:

public Player target;

While “Player” is another C# script where my player controlls are set this script is about camera follow.