public class Respawn : MonoBehaviour {
private Vector3 StartPoint;
// Use this for initialization
void Start () {
StartPoint = this.transform.position;
}
void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Respawn"))
{
//transform.position = StartPoint;
//SceneManager.LoadScene("SampleScene");
transform.position = StartPoint;
//this.transform.position = StartPoint + new Vector3(Random.Range(-7f, 1f), -7f, 1f);
}
}
Hi I put the walls out of the game screen as you see in the video and the picture. I want to reset the position when I hit the top walls, ie when I go out of the game but the position is reset but this is constantly repeating.Because if the ball strikes the walls and hits the walls I want it to return to the first place.I do not want to replay the scene, Score: "The score is reset when you play the scene again because of the score, so there is no other solution?
Video :