I am trying to calculare at each Update() the total length (as y scale) of a series of instantiated object.

In my case, the script scales a cylinder along the y axis, then at a certain y-scale value, a new cylynder is instantiated as child of the previous one.

How can I calculate the total length as sum of y-scale of each cylinder?

Also, I need to store this total length each update in a variable because I need it to do some other calculations.

For instance, at 3 instantiated cylinders, my situation is like this one in the image:

each gameobjectMESH has y-scale that I need, while the containers (the gameobjects without “mesh”) have not (y-scale = 1).

So, to summarize, I need to sum each y-scale value of every gameobjectMESH at each Update().

Thank you!