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