So I have this list that gets new items when I press a button, and when I press another button the list gets displayed, but each time the list gets displayed, you can still see the old list… kinda like this:
adds new item
displays list
- one item
adds new item
displays list
-one item
-one item
-second item
adds new item
displays list
-one item
-one item
-second item
-one item
-second item
-third item
and so on…
but I want it to like clear the old one and only display the new list
public void ShowInventory()
{
foreach (var name in inventory)
{
inventoryText.text += name + "\n\r";
}
}
I use a UI text element to display it