I use the data on a JSON file to instantiate objects and give them parameters like speed, I instantiate them and then put them on an Array, but when I give parameters to one instance, it override the same variable on all instances.
for (i=0;i<=input["numberRobots"].AsInt;i++){
robots_.GetComponent(Differential).speed=input["Robots"]*["speed"].AsInt;*_
}
“input” is my JSON object, Differential is the script that all the instances have.
I print the values of speed each iteration, and i get the correct values from the JSON files, but when after that, i print all the values on the array, it’s the same on all the instances.
The value of the last instance override all the others.