I have 6 InputFields in my scene. Their content type is decimal.
I fetch values from these input fields and check if their sum is equal to 100.02. I enter 16.67 in all of them.
float fireP = float.Parse(firePercentage.text);
float waterP = float.Parse(waterPercentage.text);
float lightP = float.Parse(lightPercentage.text);
float nightP = float.Parse(nightPercentage.text);
float natureP = float.Parse(naturePercentage.text);
float healthP = float.Parse(healthPercentage.text);
float total = fireP + waterP + lightP + nightP + natureP + healthP;
if (total == 100.02f)
Debug.Log(" Not equal. Your sum is = " + total);
Adding the former to itself 5 times is not exactly equal to the latter, so they will not compare equal.
In this particular case, comparing with a tolerance in the order of 1e-6 is probably the way to go.