I use unity and visual studio 2017 for debugging and editing my unity code and i created a bool function, but when it returns true the if statement will not do what is inside :-
My Function:-
private bool EnemyClosed(float enemyv, float playerv)
{
    for(float i = -0.9f; i<=0.9f; i+=0.1f)
        if (enemyv == (playerv + i))
            return true;
    return false;
}
The error is in there if (enemyv == (playerv + i)) return true; i debugged the code while the enemyv equals to (playerv + i) but it wont return true and i dont know why, is there any error please?
Edit :-
I know i can't compare floats using equals sign but when i compare them using Mathf.Approximately function it needs some time to find the result, i saw this while i was debugging my program and i used immediate window to find their equality using above function allways it spent some time to find the result so i don't want to use Mathf.Approximately function so please help me to find some easy code to compare them.
