Hi boys are new of unity I would want to ask you a question: I have created a panel where there is a count when every time that an object destroys with tag through script, it increases the number. the problem and that (with the attached script) it doesn't increase the number to destroyed object. Can you help me? thanks a lot. Code (CSharp): using UnityEngine; using System.Collections; using UnityEngine.UI; using System; public class clickinv : MonoBehaviour { int counter = 0; public GameObject uniqueButton; public Button myButton; public Text scoreText; public int score; private object levelButton; public void ButtonClick() { counter++; } // Use this for initialization void Start() { myButton.interactable = false; Button btn = myButton.GetComponent<Button>(); btn.onClick.AddListener(TaskOnClick); } void TaskOnClick() { scoreText.text = "" + score; { score--; if (score == 0) myButton.interactable = false; if (GameObject.FindWithTag("mace") == null) { score++; } } } }
Have you tried adding debug logging or a breakpoint to line 38 to check that the button click is working?