我正在尝试使相机在按下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);
}
}
我尝试调用该方法,但是出现了CS0201错误,于是我试着这样做:
new Transform(controlled.GetComponent<Transform>;)
但仍然没有成功,因此我来这里寻求帮助。