- Home /
I'm not sure how to explain this
Vector2 worldPoint;
worldPoint.x = scale.x * point.x;
worldPoint.y = scale.y * point.y;
print(worldPoint.y);
print(worldPoint);
So... worldPoint.y is printed as 1.25. worldPoint is printed as (3, 1.3) The x-value is what it should be.
Answer by Bunny83 · Sep 23, 2019 at 02:36 AM
Sorry but I don't understand the question. Your first print statement just prints the y value of the vector2. Your second print statement prints the whole Vector2 which is converted to a string by it's ToString method that Untiy has implemented. It will print both components rounded to 1 decimal place seperated with a comma and enclosed in brackets for better readability.
If your question was about why the values are rounded to 1 decimal place, it's because printing 2 / 3 or 4 floating point values in a row with full precision is quite hard to read. If you need to know the exact value of one of the components, print them seperately or use the ToString overload that takes a format string and specify which number format you want to use for all components
Oh man, thank you. I was unaware that the print statement rounded the number.
Your answer
Follow this Question
Related Questions
Printable version of the documentation? 1 Answer
Display a block of text to the screen 0 Answers
Printing PDF on OSX 0 Answers
How can I print images to a pdf or other printable format? 0 Answers
Difficulty with Vector2 Lerp, object jumping, not moving 2 Answers