场景的保存,代码的保存
类名和文件名保存一致
场景的保存,代码的保存
类名和文件名保存一致
int:声明整数bian liang
#一键注释:(ctrl+k)+(ctrl+c)
日志输出
//单行注释
/*
*多行注释
*/
void Start (){
//只会执行一次
}
void Update (){
//每帧执行一次
}
Carl +s--->保存
C#脚本名要与类名一
int赋值
=把右边的值赋值给左边
数据类型
Debug
public class NewBehaviourScript2 : MonoBehaviour
{
void Start()
{
print(1);
print("124234");
Debug.Log(1);
Debug.Log("12312");
Debug.Logwarning("142124");
Debug.LogError("12412412");
}
void Update()
{
print(2);
}
变量名字不能数字开头
Debug.Log(输出字符串)
Debug.logwarning(输入字符串)
1,int //整型 //常用 (范围:-128~127)
sbyte 內存小 //整型 //常用 (范围:负2亿~正2亿)
2,float //范围小 //內存小
double//范围大 //內存大
3,float mp3 =18.7; (错) //属于double
float mp3 =18.7f (对)//属于float
1,int //整型 //常用 (范围:-128~127)
sbyte 內存小 //整型 //常用 (范围:负2亿~正2亿)
2,float //范围小 //內存小
double//范围大 //內存大
3,float mp3 =18.7; (错) //属于double
float mp3 =18.7f; (对)//属于float
1
using :命名空间
public class [类
void [方法名] {}:方法
window-console输出
输出方式:print(MonoBehaviour)
Debug.Log(任意地方)
Debug.LogWarning(输出警告)
Debug.LogError()
多行注释
/*
脚本文件名与类名保持一致
选中,ctrl k+ctrl c,全部注释(//)
int [] hps = {1,2,3,4,5,6,7,8,}
for(int i =0;i<8,i++){
print(hps[i])}