method returns wrong values on specific system (win 11 issue?).

I am using this method to extract min/max values from a string and generate a random value. the string format is like this [value1,value2]. It works perfectly on the two win 10 systems that i tested the game on, but in a third system with win 11 it only returns non decimal values. example : This string is inserted as an argument "AlterWeaponPower[0.05,0.15]". in the first two systems it returns a number between 0.05 and 0.015. in the third system it returns a number between 5 - 15.

what could be the cause of this madness?

     float ExtractValue(string effect)
         float finalValue;
         int indexA;
         int indexB;
         float[] values = new float[2];
         indexA = effect.IndexOf('[') + 1;
         indexB = effect.IndexOf(',');
         values[0] = float.Parse(effect.Substring(indexA, indexB - indexA));
         indexA = effect.IndexOf(',') + 1;
         indexB = effect.IndexOf(']');
         values[1] = float.Parse(effect.Substring(indexA, indexB - indexA));
         Log.current.SetText(effect+ "
"+"min : "+values[0] +"
" + "max : " + values[1]);
         finalValue = RandomizeValue(values[0], values[1]);
         return finalValue;

Not all locales use period ('.') character as the decimal separator. Many parts of the world use the comma (',') as a decimal separator. So if the computer in question uses commas as a decimal separator, your code will fail. To force "float.Parse" use period as the decimal separator, pass in CultureInfo.InvariantCulture to it.

In general, when parsing numbers in strings it's useful to always consider what locale you're parsing them from.

Thanks for the answer. I ended up manually setting the locale at the game's startup.