string name = "juedizanshi"
string name = "juedizanshi"
Transform[] children = transform.GetComponentInChildren<Transform>()
数学运算符:+ - * / %
赋值运算符:= += -= *= /= %=
比较运算符: > < >= <= == !=
逻辑运算符(bool):&&(与)||(或)!(取反)
public 公有变量 可以在面板调用
private 私有变量 不可以在面板调用
GameObject 游戏物体
拖拽赋值可能会丢失 出现空指针
using Sysytem.Collectioms;
using Sysytem.Collectioms.Generiz;
using unityEngine;
//mangespace
public class NewBehivourScript : MonoBchaviour{
//Use this mtah
transform t in children
int[] = {1,2,3,4}
int a=10; int b=20;
int hp=a+b;
print(hp);
enum==枚举类型
enum 名字{
asdf,
dasfas
}
Mingzi mingzi=mingzi.asdf;
public int hp=100;
private int mp=300
脚本前三个是命名空间
灰色的代表没有使用,白色的代表使用
void stts{
Enemy enemy1 = new enemy();
enemy1.name="sb";
Enemy enemy2=new enemy();
enemy2.name="2B"
print(ememy.name +"-" +enemy.2name);
}
class Enemy{
public string name;//public
public int hp;
}
void Start(){
int hp=100;
Enemy=enemy1=new Enemy();
}
class Enemy{
string name;
int hp;
}
void st{
int res=Add(10,60);
print(res);
}
int Add(int a ,int b){
int res = a+b;
return res;
}
for(int i = 1;i<=10;i++){
print("nmsl")
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//namespace
public class NewBehaviourScript : MonoBehaviour {
// Use this for intialization
void Start() {
print (1);
}
//Update is called once per frame
void Update () {
print(2);
}
}
1秒等于50帧
start
第一步打开unity,第二步点击project,会出现一连窜英文单词,点击c#Script,再点击Crate,会出现NewbehaviourScript,会出现这个画面。
打开浏览器,输入vs2017,开头。会出现网站。
// /*
*/
//1
print(1); // () ()