- Home /
More Vector3 decimal precision in the Console?
Is there a way to increase the decimal precision in the Console when displaying a Vector3? For example:
Debug.Log(Vector3(0.12345, 0.12345, 0.12345));
Returns:
(0.1, 0.1, 0.1)
UnityEngine.Debug:Log(Object)
Whereas the much more awkward:
var v:Vector3 = Vector3(0.12345, 0.12345, 0.12345);
Debug.Log("(" + v.x + ", " + v.y + ", " + v.z + ")");
Returns what I would prefer, albeit with a much more awkward syntax:
(0.12345, 0.12345, 0.12345)
UnityEngine.Debug:Log(Object)
Answer by Loius · Nov 13, 2010 at 04:06 AM
Nope, Vector3's debug is truncated specifically so you don't have to worry about all those in-most-cases-irrelevant digits.
Create your own function called DebugVector3 or some such and call that instead of Debug.Log for vectors.
Answer by JoeStrout · Oct 27, 2011 at 07:54 PM
No need to create your own; Vector3.ToString takes a format specifier. See: http://answers.unity3d.com/questions/58245/more-precise-vector3.html
Answer by jmarcos007 · Mar 15, 2021 at 02:23 AM
Just debug each dimension. Like:
Debug.Log(my_vector.x); Debug.Log(my_vector.y); Debug.Log(my_vector.z);
Your answer
Follow this Question
Related Questions
Convert double to float for Vector3 1 Answer
Precision problem when moving Rect values 2 Answers
Custom World Coordinate system? Changing Space.World? 2 Answers
Any solution For extreamly large gameworlds [Single Precision Problem] 1 Answer
Number of Vector3 cords in list should be changed, but list is not changing? 0 Answers