How to show accurate values of Vector2 when using Visual studio?

When you look at the values of Vector2 in the visual studio watch window, they are only shown to one decimal point accuracy. How can I improve this? I know you can expand it to look inside the structure at the values but this is very inconvenient.

There is no way around that as far as I know. Visual Studio just uses the .NET standard .ToString method of an object. Unity just rounds the output to 1 decimal place. Most custom types do not have a proper string representation. Be default a class or struct will just return it’s type name when ToString() is called. A custom type can override ToString to provide a different result. Unity did that for Vector3. This behaviour can not be changed. Unity has implemented a special overload of ToString which accepts a format string which is used for each component. However that’s a completely different method and not a standard at all. You can use that method in your own code, however you can not make VS to use that instead.

In what exact cenario do you want to see the exact position of a Vector3 value? In most debugging cases you don’t really need to watch a single value for a long time. Debugging is about narrowing down the possible causes for a certain misbehaviour.

There are some ways to control how a certain type or variable will be displayed in the debugger by using the DebuggerDisplay attribute. However this can not be attached to the Vector3 struct itself since it’s a built-in type of Unity. Likewise you can not attach the attribute to properties of built-in classes like transform.position for the same reason. However it should work on your own Vector3 fields.

It might be possible to implement a custom visualizer, however I have never used them and this seems a bit of an overkill for debugging a Vector3 value.