Quantcast
Channel: Questions in topic: "unitywebplayer"
Viewing all articles
Browse latest Browse all 452

For with float i returning wrong number.

$
0
0
Hi, I want to make a "For" like this: for (float i = 0; i <= 1; i+=0.1F) { BSMaterial.color = new Color(BSColor.r, BSColor.g, BSColor.b, BSColor.a - i); yield return new WaitForSeconds(0); Debug.Log(BSMaterial.color.a); } but it gains a Wrong value when I = 0.7, then "I" comes with "0.6900001" and all values after this comes wrong making an infinite loop. Mathf.Round don't worked for me, since Mathf.Round round a number to 1. Sorry if I said something wrong, and thanks for helping me.

Viewing all articles
Browse latest Browse all 452

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>