浮点数转字符串
浮点数转字符串
using UnityEngine; public class Juse : MonoBehaviour { float a = 2; float b = 6666.6666f; void Start() { Debug.Log(a.ToString("#00"));//输出:02 Debug.Log(a.ToString("#00.00"));//输出:02.00 Debug.Log(b.ToString("#00"));//输出:6667 Debug.Log(b.ToString("#00.00"));//输出:6666.67 } }