Continuing the discussion from Error in run unity:
Assets\Scripts\Control\PlayerController.cs(19,52): error CS0103: The name ‘GetMouseRay’ does not exist in the current context
this is all the code
using System;
using RPG.Combat;
using RPG.Movement;
using UnityEngine;
namespace RPG.Control
{
public class PlayerController : MonoBehaviour
{
private void Update()
{
InteractWithCombat();
InteractWithMovement();
}
private void InteractWithCombat()
{
RaycastHit[] hits = Physics.RaycastAll(GetMouseRay());
foreach (RaycastHit hit in hits)
{
CombatTarget target = hit.transform.GetComponent<CombatTarget>();
if (target == null) continue;
if (Input.GetMouseButtonDown(0))
{
GetComponent<Fighter>().Attack(target);
}
}
}
private void InteractWithMovement()
{
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);
}
}
}
}