So, I did a void here that is used to change the gameObject’s material:
void ChangeTextureViaTerrain(int xx, int yy)
{
float thistile = gM.world[xx + yy * gM.worldWide]; //here
if (thistile == 2f)
{
material = materials[0];
}
else
{
if (thistile > 0.8f)
{
material = materials[2];
}
else
{
material = materials[1];
}
}
}
So, there is an error where it says //here.
It says:
“ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index”
However, the list HAS the item that is trying to index. Why it doesn’t and gives an error?