A* Algorithm Node Grid Generation

Hello there! Recently I have tried implementing A* algorithm and I got stuck right at the beginning. I tried to make grid by simply creating multiple instances of GameObject “Node” which had Node script attached to it. Problem with that was when I would instantiante I couldn’t really modify content of Node script. Other soulution would be maybe to not instantiate objects but just to make grid with arrays but I am not sure how would I detect if node is walkable or not by that way. Sorry for my english its not my first language. I will post code so you can understand me easier.



I would certainly go the 2D array route, you could create a new class which alows you to save position, walkable, weight? (for how long it takes to walk over) ect and make a 2D array of that class, then you could raycast from the position + 100 for example straight downwards, if you hit your terrain then set the walkable boolean to true, if you hit an ‘obstacle’ then set walkable to false.

Might i recommend this amazing tutorial series: A* Pathfinding Tutorial (Unity) - YouTube