Public variable cannot be assigned in inspector

So the title says it all really. When I try to drag the player into the PlayerHealth spot in the inspector nothing happens. I have double checked that the player has a script named PlayerHealth and that they are both spelled correctly. Anyone has any ideas?

using UnityEngine;
using UnityEngine.SceneManagement;


    public class GameOverManager : MonoBehaviour
    {
        public PlayerHealth playerHealth;       // Reference to the player's health.
        public float restartDelay = 5f;

        Animator anim;                          // Reference to the animator component.
        float restartTimer;

        void Awake ()
        {
            // Set up the reference.
            anim = GetComponent <Animator> ();
        }


        void Update ()
        {
            // If the player has run out of health...
            if(playerHealth.currentHealth <= 0)
            {
                // ... tell the animator the game is over.
                anim.SetTrigger ("GameOver");

                restartTimer += Time.deltaTime;

                if (restartTimer >= restartDelay)
                {
                    Scene scene = SceneManager.GetActiveScene();
                    SceneManager.LoadScene(scene.name);
                }
            }
        }
    }

Do you have any compiler errors? I’ve run into that too when I’m trying to drag a component like that.