in this script that I copied from a tutorial theres a problem in the line GetComponent rigidbody2d = vector2.zero. The error is as the title says. I changed the line according to the comments since the line he used in the tutorial wasnt valid for unity 5. But this line doesnt work either and i dont know what to change.
{public GameObject currentCheckpoint;
private PlayerController player;
public GameObject deathParticle;
public GameObject respawnParticle;
public float respawnDelay;
// Use this for initialization
void Start () {
player = FindObjectOfType<PlayerController>();
}
// Update is called once per frame
void Update () {
}
public void RespawnPlayer()
{
StartCoroutine ("RespawnPlayerCo");
}
public IEnumerator RespawnPlayerCo()
{
Instantiate (deathParticle, player.transform.position, player.transform.rotation);
player.enabled = false;
player.GetComponent<Renderer> ().enabled = false;
GetComponent<Rigidbody2D> () = Vector2.zero;
Debug.Log ("Player Respawn");
yield return new WaitForSeconds (respawnDelay);
player.transform.position = currentCheckpoint.transform.position;
player.enabled = true;
player.GetComponent<Renderer> ().enabled = true;
Instantiate (respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation); }}