Individualize variables in elements on list.

Hello.
How are you?
I have a question with my list. I have some variables within a list that I want to be rounded up when I pass the limit. The problem with having a for is that I don’t know how to tell you that if any variable in one of my list elements exceeds the file I put in so that it is rounded, I rounded only that one, not the whole list. I leave you the code, to see if you can help me.

By the way, the method “OperationMines”, is applied in an Invoke Repeating, every second.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;


public class CaracteristicasMinas : MonoBehaviour
{
   
    [System.Serializable]
    public struct Mejoras
    {
        public int siguienteMejora;
    }

    [System.Serializable]
    public class Minas
    {
        public Sprite image;
        public string nombre;
        public float produccion, almacen, multi, mejora, habitantes;
        public TextMeshProUGUI panelTexto;
       
       
    }
    public List<Minas> recursos = new List<Minas>(); 
  
    public void FuncionamientoMinas()
    {

        for (var i = 0; i < recursos.Count; i++)
        {
            recursos[i].produccion = recursos[i].produccion + (recursos[i].multi * recursos[i].habitantes);
            //recursos[i].produccion = Mathf.Ceil(recursos[i].produccion);
            recursos[i].panelTexto.text = recursos[i].produccion.ToString();
            if(recursos[i].produccion > 10.000)
            {
                 // recursos[i].panelTexto.text = (recursos[i].produccion / 1000).ToString()+"K";
            }
            if (recursos[i].almacen < recursos[i].produccion)
            {
                recursos[i].produccion = recursos[i].almacen;
                recursos[i].panelTexto.text = recursos[i].produccion.ToString();
            }
           
        }
 
    }

}

Are you speaking about the rounding operation, as done by this API:

Or are you speaking about “Wrapping”, as in passing 10 and returning to 0? That is not rounding.

Everything on a computer is done one item at a time, generally through a for() loop or other iterating construct.

Hi. Thanks for answering.
The problem I have is that I want that if some of the variables of my elements, is passed for example of 10.000, alone I changed that automatic one, without having to select each one, since I will have many and it would not be efficient. Thank you.

I’m sorry, I am unable to understand what you want.

How to report problems productively in the Unity3D forums:

http://plbm.com/?p=220

Hello.
If it is difficult to express myself, since I am Spanish and use the translator.

I’m going to show it to you with images, to see if it is clearer:
I have this in the inspector, which are a list of a class with some parameters, then when creating an element, it creates one with all those variables (The code of this is in the first post). What I want to obtain, is that the float that is in the following image, surpasses the 10,000 in any variable of “Production”, in all the elements that I have in my list, is changed only the one that surpasses it, A VARIABLE WITHIN AN ELEMENT, NOT ALL THE VARIABLES OF ALL THE ELEMENTS OF MY LIST, since I use a for, so that it checks all at the same time, but that it does not change all, either stopping the for or something.
The concept is that I write a code that makes it encompass all my list and if it exceeds a limit in one, make the change in one, not in all and that I don’t have to select all the elements of my list to be done individually: EJ “recursos[0], recursos[1]…”

Thank you.
6348084--705576--upload_2020-9-25_12-3-51.png

Thank you!