Unity To Android - Simple If Statement Not Working
Just tested my game in Unity editor and all works fine: void Update () { if (transform.position.y < -3f) { Debug.Log ('game over!'); prepareGam
It's best practices not to compare float values.
Solutions:
1) Use Mathf.Approximately(float a, float b) link
2) Use Mathf.RoundToInt(float f) link
3) Use triggers. This might be more than you need for this solution
I don't have enough rep to link #3 but lookup Collider.OnTriggerEnter(Collider)
Post a Comment for "Unity To Android - Simple If Statement Not Working"