Getting Around a Protected Path

Hi, the AIPath.cs script contains the definition “protected Path path;”. I have been changing this to “public Path path;” in order to make my own code work:

public Pathfinding.AIPath playerAIPath;

This is a manually created link to the player object’s AIPath component. Which is used link this:
playerAIPath.path.vectorPath.Count;
Essentially I just need to expose the path’s vectorPath.count, but every time I update A* Pathfinding Project I have to make it public again. This makes me think there might be a smoother way to achieve my goals. Can anyone point a newbie in the right direction? Thanks!

1 Like

You could make a new class’s that inherits from AIPath to handle this.
For example:

Public class AIPathCustom : AiPath
{
    Public int GetPathLength() 
    {
         Return playerAIPath.path.vectorpath.Count;
    } 
} 
3 Likes

Thank you! I knew this was a general coding question, but I was not sure if there were specifics to A*PP that might trip me up. :heart: