Answer the question
In order to leave comments, you need to log in
Why does the script work differently in the compiled apk than in the unity editor?
There are lists of variables itemList, bonusList, both, mobileList.
public List<Item> itemList = new List<Item>();
public List<Item> bonusList = new List<Item>();
[HideInInspector]public List<Item> both = new List<Item>();
public List<mobile> mobileList = new List<mobile>();
[HideInInspector]public List<int> mobileCurCosts = new List<int>();
[HideInInspector]public List<GameObject> mobileBtns = new List<GameObject>();
for (int i = 0; i < usualCurCosts.Count; i++)
{
if (!both[i].isBonusPerSec)
itemBtns.Add(Instantiate(prefab, shopPanels[1].transform));
else
itemBtns.Add(Instantiate(prefab, shopPanels[2].transform));
}
for (int i = 0; i < mobileCurCosts.Count; i++)
{
var x = i;
mobileBtns.Add(Instantiate(prefab, shopPanels[3].transform));
mobileBtns[i].transform.GetChild(0).GetComponent<Text>().text = mobileList[i].name;
mobileBtns[i].GetComponent<Button>().onClick.AddListener(delegate { buyMobile(x); });
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question