diff --git a/Assets/Scripts/Ally/AllyUpgrade.cs b/Assets/Scripts/Ally/AllyUpgrade.cs index c4ade89..2fdd0df 100644 --- a/Assets/Scripts/Ally/AllyUpgrade.cs +++ b/Assets/Scripts/Ally/AllyUpgrade.cs @@ -49,12 +49,12 @@ public class AllyUpgrade : MonoBehaviour, IPointerClickHandler private void AssignUpgrades(Canvas canvas) { + Debug.Log("Upgrade count: " + _instance.transform.childCount); // Assign upgrade Prefabs for (int i = 0; i < _instance.transform.childCount; i++) { GameObject upgradeEnfant = _instance.transform.GetChild(i).gameObject; UpgradePlacementButton button = upgradeEnfant.GetComponent(); button.Initialize(_upgradeUnitCardList[i], _upgradePrefabList[i], gameObject, canvas); - Debug.Log("Button " + _upgradePrefabList[i].name); } }} diff --git a/Assets/Scripts/UnitTree/UnitTreeDisplay.cs b/Assets/Scripts/UnitTree/UnitTreeDisplay.cs index d3979d0..556ee0b 100644 --- a/Assets/Scripts/UnitTree/UnitTreeDisplay.cs +++ b/Assets/Scripts/UnitTree/UnitTreeDisplay.cs @@ -7,7 +7,6 @@ public class UnitTreeDisplay : MonoBehaviour, IPointerEnterHandler, IPointerExit { //private Vector3 _originPosition; private Vector2 _size; - GameObject _gameObject; private RectTransform _rectTransform; diff --git a/Assets/Scripts/UnitTree/UpgradePlacementButton.cs b/Assets/Scripts/UnitTree/UpgradePlacementButton.cs index 97a723f..64bdac4 100644 --- a/Assets/Scripts/UnitTree/UpgradePlacementButton.cs +++ b/Assets/Scripts/UnitTree/UpgradePlacementButton.cs @@ -23,7 +23,7 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler private GameObject _prefab; [SerializeField] private GameObject _buttonContainer; - private GameObject _parentGameObject; + private GameObject _unitGameObject; private Canvas _canvas; @@ -59,11 +59,10 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler public void OnPointerClick(PointerEventData eventData) { //Change parent GameObject - Vector3 instantiatePosition = _parentGameObject.transform.position; + Vector3 instantiatePosition = _unitGameObject.transform.position; Debug.Log("Upgrade clicked..."); - Debug.Log("Position: " + instantiatePosition); Instantiate(_prefab, instantiatePosition, Quaternion.identity, _canvas.transform); - Destroy(_parentGameObject); + Destroy(_unitGameObject); Destroy(_buttonContainer); } @@ -76,7 +75,7 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler SetTextFor(_rockLabel, card.Rock); _unitCardInformation = card; _prefab = prefabGameObject; - _parentGameObject = parentGameObject; + _unitGameObject = parentGameObject; _canvas = canvas; } } \ No newline at end of file