public void setStat(string statName, string statValue) { if (StatObjectList.ContainsKey(statName)) { StatObjectList[statName].Description.text = statName + ": " + statValue; } else { StatInfoObject newItem = Instantiate(statObjectProto, transform.position, transform.rotation, transform) as StatInfoObject; newItem.Init(); LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent <RectTransform>()); //If the stat doesnt exist and we are setting it, lets just create it StatObjectList.Add(statName, newItem); StatObjectList[statName].Description.text = statName + ": " + statValue; } }
public void updateStatInfo(string stat, string value) { StatInfoObject statInfo = StatObjectList[stat]; statInfo.Description.text = stat + ": " + value; }