Hey guys, so as the title says I am getting the following error:
NullReferenceException: Object reference not set to an instance of an object
RPG.Combat.Fighter.Update () (at Assets/Scripts/Combat/Fighter.cs:14)
this is the code
using UnityEngine;
using RPG.Movement;
namespace RPG.Combat
{
public class Fighter : MonoBehaviour
{
Transform target;
private void Update()
{
if (target != null)
{
GetComponent<Mover>().MoveTo(target.position);
}
}
public void Attack(CombatTarget combatTarget)
{
target = combatTarget.transform;
}
}
}
if it helps I am at 03:42 timer in that video!
thank you!