Creating a pop-up UI element

I’m having a bit of trouble making a pop-up menu in a game I’m working on. I have a menu button in the corner of the screen, and when I click on it, I want a menu button to pop up with an animation that I did. I have the animation working just fine, and when I drag the pre-fab into the heirarchy under the canvas everything runs just fine, but my problem is coming from instantiating it with code. Here is the code I’m using

using UnityEngine;
using System.Collections;


public class PopUpMenuScript : MonoBehaviour {

    public GameObject popUpMenuPrefab;

    // Use this for initialization
    public void PopUpMenuInstantiator(Transform newParent){
        GameObject popUpMenu = Instantiate (popUpMenuPrefab, new Vector3 (1f, 1f, 1f), Quaternion.identity) as GameObject;
        popUpMenu.transform.SetParent(newParent, false);
    }
  
}

so I have the popUpMenuPrefab, and in the inspector I clicked on the PopUpMenuScript and dragged my prefab onto that variable, but whenever I run the game and click the button, it gives me this error

Long Error Text

UnassignedReferenceException: The variable popUpMenuPrefab of PopUpMenuScript has not been assigned.
You probably need to assign the popUpMenuPrefab variable of the PopUpMenuScript script in the inspector.
UnityEngine.Object.Internal_InstantiateSingle (UnityEngine.Object data, Vector3 pos, Quaternion rot) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineObjectBindings.gen.cs:60)
UnityEngine.Object.Instantiate (UnityEngine.Object original, Vector3 position, Quaternion rotation) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.cs:80)
PopUpMenuScript.PopUpMenuInstantiator (UnityEngine.Transform newParent) (at Assets/Scripts/PopUpMenuScript.cs:11)
UnityEngine.Events.InvokableCall1[UnityEngine.Transform].Invoke (System.Object[ ] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:168) UnityEngine.Events.CachedInvokableCall1[UnityEngine.Transform].Invoke (System.Object[ ] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:286)
UnityEngine.Events.InvokableCallList.Invoke (System.Object[ ] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:602)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[ ] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:744)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:52)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:269)
UnityEngine.EventSystems.EventSystem:Update()

That’s rather long, so I think the most relevant part is this:

UnassignedReferenceException: The variable popUpMenuPrefab of PopUpMenuScript has not been assigned.
You probably need to assign the popUpMenuPrefab variable of the PopUpMenuScript script in the inspector.

But I thought I did that by dragging my prefab into the spot for it on the script. I have the script being called from a button click.

So, what do I need to change?

are you assigning this on the PopUpMenuScript prefab in the project view? prefabs can’t remember links to anything that isn’t within the family of the prefab (i.e. the prefab’s root gameobject of any descendant)

Yes, that is what I am doing. Where should I assign it then?