Hi All,
I didn’t see anything in the Q&A under this lecture or the following bug-fix one, so its possible this is an issue I caused myself!
The problem faced is that after the ball drops off the screen and triggers the LoseCollider.cs, the score persists on screen.
It remains on screen after the “Start Menu” scene is loaded and even when a new game is launched.
EDIT: I jumped to the forums prematurely! Seems this is covered in another lecture shortly after the aforementioned.
I have masked my solution in case those of you who stumble onto this want to take on the challenge yourselves.
I resolved this by adding a couple lines to the LoseCollider.cs to find the GameStatus object and destroy it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoseCollider : MonoBehaviour
{
// Config params
GameObject gameStatus;
private void OnTriggerEnter2D(Collider2D collision)
{
StartCoroutine(waiter());
gameStatus = GameObject.Find("GameStatus");
}
IEnumerator waiter()
{
yield return new WaitForSeconds(1);
SceneManager.LoadScene("Game Over");
Destroy(gameStatus);
}
}
Hopefully this is useful for anyone encountering the same.