Hi there,
In the course you create a namespace RPG.Movement and add it in the playerControler.cs
Below in the code you use GetComponent().MoveTo(hit.point); but you have the RPG.Movement namespace. does the GetComponent become obsolete when you add the namespace RPG.Movement ?
using RPG.Movement;
using UnityEngine;
namespace RPG.Control
{
public class PlayerControler : MonoBehaviour
{
private void Update()
{
if (Input.GetMouseButton(0))
{
MoveToCursor();
}
}
private void MoveToCursor()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
bool hasHit = Physics.Raycast(ray, out hit);
if (hasHit)
{
GetComponent<Mover>().MoveTo(hit.point);
}
}
}
}