From dd8a5af89dfbf2eb10c16a520b578b5f5328d177 Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Sat, 11 Jul 2020 17:12:28 -0400 Subject: [PATCH] Fixed bug of life hearts destroying out of order after scene restart --- Assets/Scripts/PlayerScript.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/PlayerScript.cs b/Assets/Scripts/PlayerScript.cs index 3e5468d..e4f024d 100644 --- a/Assets/Scripts/PlayerScript.cs +++ b/Assets/Scripts/PlayerScript.cs @@ -68,7 +68,13 @@ public class PlayerScript : MonoBehaviour { life--; - Destroy(GameObject.FindWithTag("Life")); + if(life > 0) + { + Destroy(GameObject.Find("Life ("+life+")")); + } else { + Destroy(GameObject.Find("Life")); + } + } }