So it´s basically getting a total sum that updates every time the groundBases´size changes
for (int i = 0; i < groundBases.Count; i++)
{
allGroundBases += groundBases*.GetComponent<MeshFilter>().mesh.bounds.size.x;*
//groundBases[] are gameObjects, but am adding only the size.x float values } I thought that this would be enough, but it seems that it updates too much and never stops increasing. I know that is because it keeps its actual size and then adds again at every frame, but I don´t know how to reset it after it changes (or whatever I have to do) and stop it when all the groundBase sizes have been added. Thanks in advance.
float groundBasesTemp = 0.0f;
for (int i = 0; i < groundBases.Count; i++)
{
groundBasesTemp += groundBases*.GetComponent<MeshFilter>().mesh.bounds.size.x;*
*//groundBases[] are gameObjects, but am adding only the size.x float values*
*}*
*allGroundBases = groundBasesTemp;*
*```*