Hi I hope you can help me I have not used unity in a few months and have forgotten a lot of the basics, on seeing your pathfinding project I decided to get back into it as it seems very useful and well designed. I believe this answer should be fairly simple but cannot figure it out, I would like to have a main menu which contains GUI buttons depending on which GUI button is pressed I would like the target position to be changed. I have no enemies as this is not a game just a model where you can walk to different areas with the press of a button. Here is what I have tried so far but with no luck:
In the AstarAI script I modified the targetPosition to look like this
public Vector3 targetPosition = MainMenuGUI2.playerTarget;
and my MainMenuGUI2 script looks like this.
`using UnityEngine;
using System.Collections;
public class MainMenuGUI2 : MonoBehaviour {
public static Vector3 playerTarget;
void OnGUI () {
if (GUI.Button (new Rect (10,10,150,100), "1")) {
playerTarget = new Vector3(40, 0, 10);
Application.LoadLevel("TestScene");
}
if (GUI.Button (new Rect (170,10,150,100), "2")) {
playerTarget = new Vector3(70, 0, 20);
Application.LoadLevel("TestScene");
}
}
}`
This does not seem to work for me though it just goes to (0,0,0) which is what it is set at in the unity inspector.
Please any help with this will be greatly appreciated.