ok so i have mapNodes[x,z] on a grid the GameObject node[x,z] stores the MapNode[x,z] script . This works however it is extremly slow, why?
public void findAllAdjacentNodes(){
for (int x = 0 ; x < mapWidth ; x++)
{
for (int z = 0 ; z< mapHeight ; z++)
{
try{
mapNodes[x,z].northNode = mapNodes[x,z+1];
}
catch{}
try{
mapNodes[x,z].southNode = mapNodes[x,z-1];
}
catch{}
try{
mapNodes[x,z].eastNode = mapNodes[x+1,z];
}
catch{}
try{
mapNodes[x,z].westNode = mapNodes[x-1,z];
} catch{}
}
}
}
Read this page : http://answers.unity3d.com/page/newuser.html For any help, please format your code. You can do this by highlighting all your code, then clicking the 10101 button at the top of the edit window. Watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers
– AlucardJay