Testing and Verifying in Edit Mode

Hey there,

I’m trying to do some pretty extensive work with AStar. I’m loving the library!

What I want to do is be able to run a seeker path from edit mode. I’ve been working on a supplemental editor for my designers, and I want them to be able to verify a path or system I built by clicking in scene view on a graph twice. Once for the start and end of the path I should calculate.

The PathProcessor doesn’t run in edit mode, however, as far as I can tell. Any tips on how I can do this?

Thanks!

Hi

You can download the current beta and then follow this tutorial: https://arongranberg.com/astar/documentation/dev_4_1_14_3886c2bf/editormode.html.

Unfortunately, due to how large the changes we’ve made to the system are, I doubt we will ever update again. If I make some clever changes, I’ll let you know!

Thanks for this documentation, I’ll begin working from there!

Is the only meaningful difference in FindAstarPath in the beta that we don’t consider if the Application is playing?

I noticed they have the ExecuteInEditMode attribute.

Also, just for your records, I found a lot of AStar’s older source, some of which is relevant, on people’s public githubs. Don’t know if you’re alright with that!

Hi

Here is the full diff for the required changes: commit 90c64824b7ed0d40c32e63628e2b624a3f690d79Author: Aron Granberg <aron.gra - Pastebin.com

Yeah, I have been meaning to send out emails to the owners of those repositories, but I haven’t gotten around to it.

This is really helpful! Thank you so much.

I noticed the EditorMode function. Where does that live? MiscSnippets isn’t in the repo I have.

Also I noticed a GridNode.ClosestPointOnNode bug fix in this diff. I’ve been noticing weird stuff too but maybe it was only in an older patch and you’ve fixed it.

Is that a new fix?

You can ignore anything in the MiscSnippets file. That is used for the documentation so that I can ensure that code snippets actually compile.

That’s a recent fix. 4.1.14 more specifically. Here is the diff: commit 51e7d345bbb09aaed650ce5c01d266eed9c041f2Author: Aron Granberg <aron.gra - Pastebin.com

Awesome. This is really helpful!

Hmm, made those changes since the diff wouldnt work directory-wise. Unity now hangs forever. Gonna dive in.

Hey Aron!

Long time no talk. Sorry to bug you again. I checked out your change log and some of those changes look really good! We had to make a lot of changes to leverage your library for our specific use case. I was wondering about the seeker SnapToGrid node change. Was that removing the .5 subtraction in GetNearest?

Also, in Funnel, I’m seeing the funneller erase every point in the path node except the last 2. Seems like a bug based on configurable settings not exposed to the user.

Hope all is well!

Rather than be vague, I specifically am seeing Funnel.FixFunnel remove every vert except the last 2.

The actual bug that was fixed by the diff was that the code used a position that had not yet been transformed to graph space. You can see that it runs “p = gg.transform.InverseTransform§;” but later in the original code “float xf = position.x-0.5F;”, it should have used p and not position there. However at the same time as I did that fix I also cleaned up and simplified the code a bit.