Assets\RayShooter.cs(10,19): error CS0411: The type arguments for method 'Component.GetComponent()' cannot be inferred from the usage в чем ошибка?
Не могу понять почему так. Учу C# по книге "Unity в действии" Джозефа Хокинга. В этом коде написано все так как в книжке
using System.Collections;
using UnityEngine;
public class RayShooter : MonoBehaviour
{
private Camera _camera;
void Start()
{
_camera = GetComponent();
}
void Update()
{
if (Input.GetMouseButtonDown(0))
{
Vector3 point = new Vector3(
_camera.pixelWidth / 2, _camera.pixelHeight / 2, 0);
Ray ray = _camera.ScreenPointToRay(point);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
StartCoroutine(SphereIndicator(hit.point));
}
}
}
private IEnumerator SphereIndicator(Vector3 pos) {
GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.transform.position = pos;
yield return new WaitForSeconds(1);
Destroy(sphere);
}
}
но Unity все равно просит поставить <аргумент> после GetComponent()
