How to change pathfinding target on click of a button?

I am trying to learn unity scripting, today I tried pathfinding using Aron Granberg’s pathfinding kit (free version).

If I set the target before playing the scene, the object successfully follows the actor, but what I wanted to do is that, when I click on GUI button, it should find the path for a Empty object which I have placed in the different part of the screen. I am not getting success this time.

Please help me to achieve the desired result.

GUI_Button.cs

using UnityEngine; using System.Collections;
public class GUI_Button : MonoBehaviour {
 
public GUIText lblMsg;
public Transform exitPoint;
AIPath ap;
 
void Start () {
ap = new AIPath();
lblMsg.enabled = false;
}
 
void Update () {
 
}
 
private void OnGUI()
{
if(GUI.Button(new Rect(15,15,100,50), "HELP ME"))
{
lblMsg.enabled = true;
ap.target = exitPoint;
ap.SearchPath();
}
}
}

You can see the full thread over here : answers.unity3d.com/questions/561025/how-to-change-pathfinding-target-on-click-of-a-but.html

Does the log say anything? (make sure you have enabled loggin in A* Inspector -> Settings -> Path Log Mode)

Give me 2 minutes, I will check it. By the way, is there any problem with the script I’ve written? If anyone can check the project. Its uploaded over here https://www.dropbox.com/s/332u4qftod90ms6/Pathfinding.zip

Path Log Mode is set to Normal. I ran it once again, still same problem

Hi

Does the log say anything?
Still, does any messages pop up in the log that could be of interest?

[EDIT]
You are creating an AIPath using the constructor.
Please do not do that. It is not the way Unity works.
Instead use ap = AddComponent();
See Unity - Manual: Creating and Using Scripts