Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Unable to re-spawn after colliding with enemy

$
0
0
Hi I am new to unity, I have written a re-spawn which works if the character falls off the edge of the map, however once the player collides with the enemy the re-spawn text will appear and the game will stop, however once I press enter nothing happens and the player is stuck. Any help would be great thanks :) Here is my code: onTriggerEnter() { if(other.gameObject.tag == "enemy") { deadText.text = "You died Press Enter to Continue"; Respawn(); } } void Respawn() { Time.timeScale = 0.0f; if(Input.GetKey("enter")) { Time.timeScale = 1.0f; deadText.text = ""; transform.position = transform.position = new Vector3 (0f, 2f, 0f); } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>