(1)浮點型(float)保留小數(shù)
float y=8.2222f;
string s = Nun.ToString("F1");//F1代表保留著一位小數(shù),F(xiàn)2 F3一次往后推
y = float.Parse(s)*; //y現(xiàn)在是8.2
(2)在Inspector面板顯示的變量凑耻,可以使用它來幫你給變量加個描述
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour
{
[Tooltip("提示生命值范圍0-100")]
public int health = 0;
}
未完·······························