Those colors are close enough they are probably identical. In fact, they may be actually identical when each color channel gets stored into the usual hardware 8 bits of an RGBA pixel.
Floating (float) point imprecision:
Never test floating point (float) quantities for equality / inequality. Here’s why:
https://starmanta.gitbooks.io/unitytipsredux/content/floating-point.html
Now that you have had your coffee, don’t forget about floating point imprecision:
// @kurtdekker: don't forget about floating point imprecision
using UnityEngine;
public class FloatingPointImprecision : MonoBehaviour
{
void Start ()
{
float a = 2000.0f;
float b = 0.1f;
float product = (a * b);
float answer = 200;
Debug.Log( "a = " + a);
Debug.Log( "b = " + b);
Debug.Log( "product of a*b = " + product);
Debug.Log( "answer =…
This will explain it all.
In an IEEE single-floating point number you can represent certain numbers perfectly and unambiguously.
For instance, 0.5f is precisely represented as 0x3f000000
However, 0.1f CANNOT be precisely represented. One possible approximate representation is 0x3DCCCCCD
The analogy is that you cannot show 1/3rd precisely as a decimal.
0.33 is correct to 2 decimal places
0.3333 is correct to 4 places
etc.
But you can never exactly represent 1/3rd as a decimal numeral. Yo…
Literal float / double issues:
Welcome! In this forum, you will get much more help if you format your code with code tags <= LINK.
Your error message actually tells you what the problem is, and how to fix it. Let’s break it down.
First, it tells you where the problem is:
Assets\PlayerMovement.cs(12,49): error CS0664: Literal of type double cannot be implicitly converted to type ‘float’; use an ‘F’ suffix to create a literal of this type
It’s happening at Line 12, Column 49. Here’s Line 12:
[SerializeField] private float …