Get error on 'GetComponent<Fighter>().Attack(target.gameObject)'

I have red line under ‘target.gameObject’ lesson chapter 47

Why is that?
This is the error:
cannot convert from ‘UnityEngine.GameObject’ to ‘RPG.Combat.CombatTarget’
What is the reference between this and that?
Need to solve the issue before getting on the challenge

Figured it out.

Yes, you can assign a CombatTarget to a GameObject (because CombatTarget inherits from GameObject) but you cannot directly assign a GameObject to a CombatTarget (because you need to know what type the GameObject is supposed to be).

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.