如何修复Unity2D中的错误(无法将方法组分配给隐式类型的变量)

时间:2019-03-23 17:18:37

标签: c# unity3d

我正在用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);

如何解决?enter image description here

1 个答案:

答案 0 :(得分:1)

您缺少一些括号

  

var targetScrips = target.GetComponent <控制器>();