I’d like to have it so that when a button is pressed, AND has successfully completed it’s associated script, the button is destroyed and removed from the UI.
Here’s my code:
public class UpgradeManager : MonoBehaviour {
public Click click;
public UnityEngine.UI.Text itemInfo;
public float cost;
public int count = 0;
public int clickPower;
public string itemName;
private float baseCost;
void Start(){
baseCost = cost;
}
void Update(){
itemInfo.text = itemName + "
Cost:" + cost + "
Viewers Per Stream: +" + clickPower;
}
public void PurchasedUpgrade(){
if (click.views >= cost) {
click.views -= cost;
count++;
click.viewsperclick += clickPower;
cost = (baseCost * Mathf.Pow (1.15f, count));
}
Any help will be greatly appreciated! ![]()
As a unity grandmaster, i can advise u to use namespace: using UnityEngine.EventSystems; and then: EventSystem.current.currentSelectedGameObject.SetActive(false); it will remove the button which was pressed. ur welcome!
– Fekalis