So I am made a script using instantiate where the player duplicates into two but there is bug:
public GameObject prefab;
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.G))
{
Instantiate(prefab, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
}
}
}
Whenever “g” is pressed my character duplicates but it starts to slowly raise until you are in the sky and no ground can be seen. I am thinking the object needs constraints but it still has to move up and down the y axis because on a completely unrelated note this “player” flies but its hard when you are ascending. Any ideas. Thank you in advance.