namespace error?? CS0029: Cannot implicitly convert type

Im having some scoping issues when using an abstract function, I think. Not sure why its doing a implicitly convert of the type when they are the same?

Class im inheriting from

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LB.Managers;

namespace LB.AStarPathFinding
{

    public abstract class AStarFindPath<T,U> : MonoBehaviour {

        public virtual void FindPath<T>(Vector3 startPos, Vector3 targetPos) {
        }

        public abstract U NodeFromWorldPoint<T,U> (Vector3 worldPos);
    }

}

Error in child class

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using LB.Managers;
using LB.AStarPathFinding;

namespace LB.HexSphereBuild
{

    [RequireComponent (typeof(PlanetBuildManager))]
    public class AStarHexSphere: AStarFindPath<Hexsphere,HexTile>
    {

        private HexSphere _hexSphereObj;


        void Awake ()
        {

            // Reference to HexSphere
            _hexSphereObj = gameObject.GetComponent<PlanetBuildManager> ().hexSphereObj;
        }


        override public HexTile NodeFromWorldPoint<HexSphere,HexTile> (Vector3 worldPos ){

            int startNodeIndex = _hexSphereObj.GetHexIndexFromPoint (worldPos);
          
            //error CS0029: Cannot implicitly convert type `LB.HexSphereBuild.HexTile' to `HexTile'
            // _hexSphereObj.Hexes is  public List<HexTile> Hexes { get{ return _hexes; }}
            HexTile startHex = _hexSphereObj.Hexes [startNodeIndex];


            return startHex;
        }

        //--------------------------------------------------------------------
        public void FindPath (Vector3 startPos, Vector3 targetPos)
        {
            // Get HexTile from start and end positions
            int startNodeIndex = _hexSphereObj.GetHexIndexFromPoint (startPos);
            HexTile startHex = _hexSphereObj.Hexes [startNodeIndex];
            int targetNodeIndex = _hexSphereObj.GetHexIndexFromPoint (targetPos);
            HexTile endHex = _hexSphereObj.Hexes [targetNodeIndex];

        }
    }

}

Looks like you have a HexTile class in the global namespace, as well as a HexTile class in the LB.HexSphereBuild namespace. You can specify which type your variable startHex is by using either LB.HexSphereBuild.HexTile startHex or ::global.HexTile startHex.

ahh , ok what do i do with the return type or the function prototype since they have to return the same type?

Wait how is it in a global namespace?

// error CS0508: return type must be `U' to match overridden member
override public LB.HexSphereBuild.HexTile NodeFromWorldPoint<HexSphere,HexTile> (Vector3 worldPos )

 // error CS1525: Unexpected symbol `.', expecting `,' or `>'
override public LB.HexSphereBuild.HexTile NodeFromWorldPoint<LB.HexSphereBuild.HexSphere, LB.HexSphereBuild.HexTile> (Vector3 worldPos ){

Could the problem be that im inheriting from an abstract generic class derived from monobehaviour ? this is legal right?

Bump , in hope for help

Also found that my next abstract method works fine, im lost as to why

        override public List<HexTile> GetNodeNeighbours<HexTile> (HexTile node ){

            List<HexTile> neighbours = new List<HexTile>();
            List<int> hexNeighboursIndices = new List<int>();

            int hexIndex =0;
            _hexSphereObj.GetNeighbors (hexIndex, ref hexNeighboursIndices);

            return neighbours;
        }

You know, on closer inspection, you don’t need to make your NodeFromWorldPoint method generic. You’re not using any different types in the methods. You’ve already declared the type of U in the class declaration. No need to redeclare it in the method signature. I suggest changing your abstract base class and removing the generics from the methods. That should help simplify your implementation.

Lol yea that it , it should not have been defined twice. Thanks for the help