I keep getting this error and I have no idea why. I’ve searched the chat and it still isn’t clear to me. please help
Most commonly in this lecture, it’s caused by trying to call Fighter.Attack() with a GameObject reference instead of a CombatTarget.
The Fighter is expecting a CombatTarget
If you send it a GameObject, it doesn’t do the conversion (finding the CombatTarget on the GameObject) automatically…
You’ll need tog get the CombatTarget off of the GameObject
yourGameObject.GetComponent<CombatTarget>(0);
1 Like
I changed the “combat target” to “game object”, but now everytime I’m in range of the enemy I get the error:
Object reference not set to an instance of an object
RPG.Combat.Fighter.Attack (UnityEngine.GameObject combatTarget)
Figured it out, Needed an action scheduler on the enemies
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.