脚本中变量的定义
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player2 : MonoBehaviour {
//类里面生命的public变量都可以在控制面板上反映出来 变量值以第一次价值的脚本值为准,当脚本中的变量值与控制面板值不一致时,脚本输出以控制面板值为准
public int hp;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
`
