Hello! I’m getting a parse error at line 62 (end of the file) in this code:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class mTile{
mTile(){
position = new Vector2();
neighbours = new List<mTile>();
}
public Vector2 position;
public List<mTile> neighbours;
};
public class CollisionGenerator : MonoBehaviour {
Dictionary<Vector2, mTile> map;
List<mTile> firstPathMap;
public int mapWidht = 0;
public int mapHeight = 0;
public float tileDensity = 1.0f;
//Collision creation goes in two passes, first I create the nodes ( If the node is notWalkable, don't create it)
//After that I create the relations between the nodes, depending if KeyExists
void Start(){
createNodes();
createRelations();
}
void createNodes(){
//First pass
for(float y = 0; y < mapHeight; y++){
for(float x = 0; x < mapWidht; x++){
Vector2 pos = new Vector2(x + tileDensity/2.0f, y + tileDensity/2.0f);
RaycastHit2D[] rayHit2D = Physics2D.RaycastAll(pos, new Vector2(0.0f, 0.0f), 0.1f);
foreach(RaycastHit2D rayHit in rayHit2D){
if(!rayHit.collider.tag == "Imovable" && !rayHit.collider.tag == "Vent"){
//Here the AI can move, create an mTile
mTile tmpTile = new mTile();
tmpTile.position = pos;
map.Add(tmpTile.position, tmpTile);
}
}
}
}
}
Dictionary<Vector2, mTile> getGraph(){ return map; }
void createRelations(){
Vector2[] dirs = new Vector2[8] {
new Vector2(-0.5f, 0.0f), new Vector2(-0.5f, -0.5f), new Vector2(0.0f, -0.5f), new Vector2(0.5f, -0.5f),
new Vector2(0.5f, 0.0f), new Vector2(0.5f, 0.5f), new Vector2(0.0f, 0.5f), new Vector2(-0.5f, 0.5f)
};
foreach(KeyValuePair<Vector2, mTile> tile in map){
for(int i = 0; i < dirs.Length; i++){
tile.Value.neighbours.Add(map[tile.Value.position + dirs*);*
-
}*
-
}*
-
}*
-
// Update is called once per frame*
-
void Update () {*
-
}*
}
Now there is something strange happening in Monodevelop, the last line is also filled with whitespaces and whenever I try to create a newline belowcreateRelations()
(hitting enter) it creates a newline… BUT it also fills half the screens width on that line with whitespaces.
I’ve searched a bit but all I can find about parse errors are because of functions named the same thing or missing curly braces, I have checked for both.
Thank you very much!