Hi, so I have a foreach that spits out the correct information. Everything works besides the information being updated when the values change.
Here’s what I want it to do
This is what my code currently looks like
void Start()
{
function();
}
void Update()
{
}
public void function()
{
foreach ()
{
// generates the list of information
}
}
Just looking for a step in the right direction on what to do.
I’ve thought about putting the function inside update() and blocking out any duplicate entries but I don’t think that’d be efficient.
First you need to know when something has changed. I don’t know how you’re generating your table, so I can’t give you specific methods, but let’s say that you have a method that gets called whenever an item changes.
Inside that method, you have two options: you can either patch your list of information, or regenerate your list of information. If you patch it, you have to retain enough semantic information in both changing the data and creating the list so that you can match up a certain change to a certain position in the list. If you just regenerate the entire list, you don’t need any semantic information at all, but performance will degrade with large enough tables. It’s up to you whether you want speed or ease of implementation more.