using System.Collections; using System.Collections.Generic; using UnityEngine; public class TimeUtil { //格式化,最终得出分和秒 public static string GetTimeStr(float time) { int seconds = (int) Mathf.Ceil(time); string str = ""; int m = seconds / 60; if (m < 10) { str += 0; } str += m; str += " : "; int s = seconds % 60; if (s < 10) { str += 0; } str += s; return str; } }