diff --git a/Assets/Scripts/Ally/AllyUpgrade.cs b/Assets/Scripts/Ally/AllyUpgrade.cs index 17f127e..dfdd8b9 100644 --- a/Assets/Scripts/Ally/AllyUpgrade.cs +++ b/Assets/Scripts/Ally/AllyUpgrade.cs @@ -1,4 +1,3 @@ -using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; @@ -31,7 +30,7 @@ public class AllyUpgrade : MonoBehaviour, IPointerClickHandler AssignUpgrades(canvas); } } - + } else { @@ -53,4 +52,13 @@ public class AllyUpgrade : MonoBehaviour, IPointerClickHandler button.Initialize(_upgradeList[i], gameObject, canvas); } } - }} + } + + private void OnDestroy() + { + if (_instance != null) + { + Destroy(_instance); + } + } +}