Prefab supposed to instantiate at the position of the player, but does not

I’ve been making a prefab called zombie, and he’s supposed to instantiate at the x and y of the player, but does not. I’ve tried serveral methods, but he’s spawns at 0,0 or at a coordinate somwhere in de very top right corner(I’m making a 2D top down), like 65473,68765 or something like that. Does anybody have experience with this kind of stuff? Here’s my code:

public GameObject zombie;

    public Entity player;

    int attackCount;

    Vector3 pos;

    // Use this for initialization
    void Start ()
    {

        pos = new Vector3(player.transform.position.x, player.transform.position.y);

        Instantiate (zombie, pos, Quaternion.identity);

    }

If anyone knows a solution, feel free to reply.

Kind regards,
Tom

What is the value of player.transform.position when you instantiate the zombie?

I’ve checked and for some random reason, its 0,0. But when I start the game the player is on 32,32.

so is the player player?

are you positioning the player in it’s own script using the start function? you might be running afoul of the “arbitrary” execution order of scripts on gameobject. Try setting up the internal logic in Awake (i.e. that which only interacts or cares about things on the current gameobject) and the intra-object logic in Start…