// Start is called before the first frame update void Start() { // Find the SimplePathFinding2D component attached to a GameObject with a Grid component. SimplePathFinding2D simplePathFinding = GameObject.Find("Grid").GetComponent <SimplePathFinding2D>(); // Create a new path using this SimplePathFinding2D object. path = new SimplePF2D.Path(simplePathFinding); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); playerLastPos = this.transform.position; rid = this.GetComponent <Rigidbody2D>(); layerMask = ~layerMask; //Create our new paths using the simplepathfinding 2d object attached to a grid gameobject path = new SimplePF2D.Path(GameObject.Find("Grid").GetComponent <SimplePathFinding2D>()); nextPoint = Vector3.zero; }
// Start is called before the first frame update void Start() { SimplePathFinding2D pf = GameObject.Find("Grid").GetComponent <SimplePathFinding2D>(); path = new SimplePF2D.Path(pf); }