So basically i have this script that is supposed to spawn the player at the checkpoint after it collides with the enemy. Only problem is, after it spawns at the checkpoint position the player is unable to move. Any help is greatly appreciated.
using UnityEngine;
using System.Collections;
public class LevelManager : MonoBehaviour {
public bool playerIsDead;
public GameObject player;
public GameObject currentCheckpoint;
public new Vector2 checkpointPosition;
// Use this for initialization
void Start () {
checkpointPosition = currentCheckpoint.transform.position;
playerIsDead = false;
}
// Update is called once per frame
void Update ()
{
if (PlayerControl.isDead == true)
{
playerIsDead = true;
}
if(playerIsDead == true)
{
player.transform.position = checkpointPosition;
playerIsDead = false;
}
}
}