UnassignedReferenceException

Hi! So I’m trying to make a quest for the player and wrote the following code:

// Applied to Quest NPC
public class Quest001 : MonoBehaviour
{
 
    public string questName = "Coin Collect";

    public string questInfo = "Collect all the coins";

    public float range = 3f;

    public Transform player;

    // I need this to set the questText to active
    public GameObject questPanel;

    // The text object to holder the questInfo
    public Text questText;

    // Same purpose like the two above
    public GameObject activeQuestPanel;
    public Text activeQuestText;

    void Start()
    {
        questText.text = questInfo;
        activeQuestText.text = "Active quest: " + questName;
    }

    void Update()
    {
        RaycastHit hit;

        if (Input.GetMouseButtonDown(2) && Physics.Raycast(player.position, player.forward, out hit))
        {
            if (hit.distance <= range)
            {
                questPanel.SetActive(true);
                activeQuestPanel.SetActive(true);
            }
        }
    }
}

I assigned all of the value in like so:
129889-bug.png

But when I play my game, it’s saying “UnassignedReferenceException: The variable player of Quest001 has not been assigned” but I can play my game fine, it works. But this exception kept showing on the console window.

Is it a bug or I did something wrong?

Note: The two text variable in the image is not the same Text.

Thanks alot! I appreciate it!

It seems to me that “Player” may have been unassigned during runtime by another script, try making player private and serialize it. There’s is nothing in your provided script that should cause this error.

 [SerializeField]
    private Transform player;