Hello i was trying to find this on google but i failed.
- I have 2 fields in my GUI one is refreshing normally after ForceMeshUpdate(), other refresh only when object is destroyed and recreated again, but i need update it just after button click , can you please help?
Thanks
a) With this code text update correctly.
var clusterText = selectedCluster.GetComponent<TextMeshProUGUI>();
clusterText.text = clusterNumber.ToString();
clusterText.ForceMeshUpdate();
b) Here it is not working
if (item.name == "TotalObjects")
{
foreach (Transform item2 in item.transform)
{
if (item2.name == "TotalObjectsGO")
{
var itemText = item2.GetComponent<TextMeshProUGUI>();
itemText.text = Galaxy.GetClusterObject(clusterNumber).objectCount.ToString();
itemText.ForceMeshUpdate();
}
}
}
Only difference in those 2 are that first “selectedCluster” is GameObjcet and “item2” is a Transform but i also tried this and still no work.
var itemText = item2.gameObject.GetComponent<TextMeshProUGUI>();
itemText.text = Galaxy.GetClusterObject(clusterNumber).objectCount.ToString();
itemText.ForceMeshUpdate();

