public void LoadFromJPG() { if (InitPathData() == false) { return; } GameObject map = GameObject.FindWithTag("Map"); if (map) { textureGrid = PathData.LoadPathJPG(loadFileName); gridPlane.material.mainTexture = textureGrid; aStarUtils = new AStarUtils(textureGrid.width, textureGrid.height); int x, z; bool bPassable; for (x = 0; x < cols; x++) { for (z = 0; z < rows; z++) { bPassable = textureGrid.GetPixel(x, z) == Color.white ? true : false; aStarUtils.GetNode(x, z).walkable = bPassable; } } bRayEnd = true; } }