A little problem

I have a big code like this :

if(current1 ==0){inventory.current1 = 255;}
if(current2 ==0){inventory.current2 = 255;}
if(current3 ==0){inventory.current3 = 255;}
if(current4 ==0){inventory.current4 = 255;}
.
.
.
.
if(current35 == 0){inventory.current35 = 255;}

This is not my code but is something like so,
And i want to make this small with for.

for(int i=1,i<=35,i++){
if(current"i" == 0){inventory.current"i" = 255;}
}

Any solve? :slight_smile: Thanks in advance!(sorry for my english)

int current = new int[34];

for(int i=1, i <= current.Length, i++){
    if(current _== 0){inventory *= 255;}*_

}
If it’s Inventory you should consider wrapping it in class.
_*I made tutorial for beginners for creating class based array. Which can be used for Inventory. ArmedUnity.com is for sale | HugeDomains