C# 字符串格式
Debug.Log(123.ToString("000000")); //output:000123
Debug.Log(255.ToString("X")); // output: FF
Debug.Log(Mathf.PI.ToString()); // output: 3.141593
Debug.Log(Mathf.PI.ToString("F")); // output: 3.14
Debug.Log(Mathf.PI.ToString("F3")); // output: 3.142
Debug.Log(Mathf.PI.ToString("E")); // output: 3.141593E+000
var v2=new Vector2(0.123456789f,0.123456789f);
Debug.Log(v2); // output: (0.1, 0.1)
Debug.Log(v2.ToString("G")); // output: (0.1234568, 0.1234568)
更多格式说明:
https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings