投掷2D相机动作脚本CS0428

我试图让相机在您按WASD或箭头键时移动,但它会抛出

错误CS0428无法将方法组“ GetComponent”转换为非委托类型“ Transform”。您是否打算调用该方法?

在此脚本上:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class cameramover : MonoBehaviour
{        
    public Camera controlled;
    Vector3 movement;

    void Start()
    {
        Transform transform1 = controlled.GetComponent<Transform>;
    }

    void Update() 
    { 
        movement = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0.0f);

    }
}

I tried invoking the method, but that threw CS0201, so I tried doing new Transform(controlled.GetComponent<Transform>;) and that didn't work either, so I went here to ask for help.

评论