как исправить ошибку (не удается назначить группу методов неявно типизированной переменной) в Unity2D

#c# #unity3d

#c# #unity-игровой движок

Вопрос:

Я создаю игру в 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);
  

как исправить?введите описание изображения здесь

Комментарии:

1. Это помогает получать ответы, если вы указываете правильный язык программирования

Ответ №1:

у вас отсутствуют некоторые круглые скобки

var targetscripts = target.GetComponent < контроллер>();