Working with GraphUpdateScene in a 2D Game


I’m a fairly new user of the Pathfinding Project and of Unity in general. I’m working on a prototype for a 2D game and am having trouble using the Graph Update Scene component to set up a Penalty Area. I’ve tried a number of different settings, but the enemy AI will not react to the penalty area that I have setup. I have also tried making the area unwalkable instead, but it seems to have no effect on the AI.

Here are some screen shots of my situation:

Taken from my Scene window. You can see the rectangular polygon from the GraphUpdateScene component:

In every example I have seen online, the polygon edges have been red. Mine are green, except for the top edge. Could this be related to the problem?

Here are my Astar Path settings:

I have “Unwalkable when no ground” disabled. I can’t get the grid to work if this is enabled.

My Graph Update Scene settings:

My Seeker Settings:

I’m not sure if any of this is relevant, but here are a few non-typical details about my scene setup that might be factors in the problem:

Since I am trying to make a pixel perfect 2D game, I’ve setup my scene so that one game unit equals one pixel, so the scale of things in my scene are much larger than normal.

My Enemy AI is based on the AIPAth.cs script, but has been modified to work for my needs.

I’ve laid out my scene so that character movement is in the X and Y dimensions. Because of this, the A* graph is rotated -90 degrees on the X-axis. I also had to disable the “Unwalkable when no ground” setting, otherwise I would get no walkable nodes.

Any help is greatly appreciated, and I’m happy to provide any more details about my project to help solve the problem. Thanks in advance!

After re-reading some of the documentation, I’m convinced that the GraphUpdateScene component isn’t actually tagging any nodes, but I still don’t know how to fix it.

Well, I was able to get penalty areas to work by using the scripting approach to graph updates described here: Graph Updates - Scripting

I still don’t know why the GraphUpdateScene component will not work, but I guess I no longer need it.