NullReferenceException from a script after linking prefab with drag and drop in inspector. WTF?

Hi guys, sorry to bother you all, I’m quite a noob in Unity but I’m learning.
I have this problem:
I’m creating a class that for the moment just Instantiates a prefab.

 using UnityEngine;
    using System.Collections;
    
    public class DeckController : MonoBehaviour {
    	
    	public GameObject testCard;
    	
    	public GameObject DrawCard()
    	{
    		Debug.Log("testCard: " + testCard.name);
    		
    		GameObject temp = (GameObject) Instantiate(testCard);
    		
    		Debug.Log("tempIsNow: " + temp.name);
    		return temp;
    	}
    }

I dragged the prefab form the Prefabs folder into the public variable: testCard.
As you can see here:

What happens is that I get a runtime exception:

NullReferenceException: Object reference not set to an instance of an object
DeckController.DrawCard () (at Assets/Scripts/CardController/DeckController.cs:10)

Row 10 is where there is the first Debug.Log, so it seems that testCard is set to null.
I don’t understand how this is possible since even in official tutorials this seemed to be the procedure… :frowning:
Help please!

Just a guess but:

Add this line at the very beginning of your DrawCard function:

    Debug.Log("GameObject name: " + gameObject.name);

to reveal that this script is attached to another object :wink: