Why is unity so bad at accuracy for something as simple as whole number coordinates.

All I want to do is make a simple block placement validator which is impossible when Unities location accuracy is almost as bad as their answer/forums community.

Additionally, here is some very odd behavior.

![183012-1.png|254x412](upload://iGdi2gmDuiM2XDFPoqNkoBqKvZ6.png)

183013-2.png

 public static void SectionPlaced(GameObject mazeTile)
    {
        SectionValidation[] children;
        children = mazeTile.GetComponentsInChildren<SectionValidation>();
        foreach (SectionValidation sectionValidation in children)
        {
            
            if (instance.placedSections.Contains(sectionValidation.gameObject.transform.position))
            {
                Debug.LogError("placed two sections in same spot");
            }
            else
            {
                Vector3 a = sectionValidation.gameObject.transform.position;

                Vector3 b = new Vector3(Mathf.Floor(a.x), 0, Mathf.Floor(a.z));

                //this is the gameobject
                sectionValidation.gameObject.transform.position = b;
                instance.placedSections.Add(sectionValidation.gameObject.transform.position);
                Debug.Log(sectionValidation.gameObject.transform.position);
            }
        }
        EventManager.TriggerEvent("OnPlaceTile");
    }

is almost as bad as their
answer/forums community

First off, you’re generally not liable to get assistance with your problem when you badmouth the community you’re seeking help from.

Lucky for you, it happens to be an interesting (if still commonly seen) subject.


In short, floating point numbers aren't a replacement for integers. They're not really comparable to integers, in the sense that (computer) math is performed in a very different manner on them. Compounded on this, 32-bit float values will have even less precision allotted to them, that they will easily not land *exactly* on an integer value.

That is only partially related to your image examples, however.

Unity’s implementation of Vectors (Vector2/3/4), when calling ToString(), rounds the decimal places of their component floating point values to the nearest tenth (i.e. single decimal place).

For reference, Debug.Log() implicitly, automatically converts anything that isn’t already into a string using any available ToString() function.

You demonstrate no awareness for basics of computer science and that is ok. Everyone starts somewhere, everyone has his Achilles’ heel; totally fine.
_
But please make sure your question is polite enough not to be mistaken for a rather unpleasant person.
Thank you.
_