I've defined an abstract method in an abstract class with a generic return type. However, when I try to use the generic type as a Vector3 (or any other variable) I get this error :
Cannot implicitly convert type 'UnityEngine.Vector3' to 'Vector3'
this is my code : the error is in the line
return direction;
using UnityEngine;
public class DashAbility : Ability
{
public Vector3 direction;
public override Vector3 getAbilityData<Vector3>()
{
return direction;
}
public override bool trigger(pointerData pointer)
{
return InputMaster.tryPointer(rollInputTest);
}
bool rollInputTest(pointerData p)
{
return (p.phase == pointerPhase.Dragging) && p.startHit.collider.CompareTag("Player");
}
}
and this is the class I'm deriving from:
using UnityEngine;
public abstract class Ability : MonoBehaviour
{
public abstract bool trigger(pointerData pointer);
public abstract T getAbilityData<T>() ;
}