我正在用Unty2D创建游戏,但出现此错误 这是代码
float startSize;
void Start()
{
startSize = this.GetComponent<Camera>().orthographicSize;
}
void Update() {
var targetScrips = target.GetComponent<controller>;
if(targetScrips.isMove)
this.GetComponent<Camera>().orthographicSize = Mathf.Lerp (this.GetComponent<Camera>().orthographicSize, startSize, Time.time * 0.001f);
else
this.GetComponent<Camera>().orthographicSize = Mathf.Lerp (this.GetComponent<Camera>().orthographicSize, startSize, Time.time * 0.003f);
答案 0 :(得分:1)
您缺少一些括号
var targetScrips = target.GetComponent <控制器>();