Positional issue. ??

Hi there,
I am getting an odd occurance that I cant explain.

My transform, is shown in the inspector with a y pos of 3.75, correctly.

However, my print out, later when I ask is 3.8, despite clicking on the transform and the inspector showing 3.75.

Ok, so is this true, the console position prints only to 1 decimal point?

Have you tried just the y value to verify? Floats certainly aren’t rounded that much.

That’s what the toString() method does. But there’s also an overload which takes a string as argument.
Try to put ‘f5’ or ‘F5’ in, it should print the values with higher precision.
Just a little more work as you always have to explicitly call ‘toString(“…”)’, but that shouldn’t be the problem.

Yes, the console only prints one decimal for Vector3’s.

Have you tried using the overload with the string parameter? You can pass “f2”, “f3” and so on.

Vector3 print function only prints to a decimal for logging purposes. To print them fully, you should create or overload for your own detailed printing. Debug.Log(thing.x) will print the full precision. This is normal.

Again.

Should have wrote solved.
So, thread solved. Cheers!

This has come up a lot, you could have searched it :stuck_out_tongue:

I may have misunderstood your answer to my question, but with

private Vector3 v3 = new Vector3(34.32131f, 1, 34.32131f);
    void Start()
    {
        Debug.Log(v3.ToString("f6"));
    }

i get:

so you can make it print more decimals. oO

Oh, nice one!