A* Pathfinding Project

Unity Package Manager compatibility (patches supplied)


#1

Hey,
I’m starting to move my dependencies over to Unity’s new package system.

My new WIP process is a directory/Unity project per asset so I can edit or update them really easily. Then my subsystems can be built in separate projects and finally all pulled together in a big unifying project at the end (without spare bits only needed by each one).

I’ve supplied two tiny patches below that I’ve added to mine that allow me to pull it in from a local directory.

Simply create a package.json with something like the following:

{
  "name": "com.arongranberg.astarpathfinding",
  "displayName": "AStarPathfinding Project by Aron Granberg",
  "version": "4.2.4",
  "unity": "2018.1",
  "description": "AStarPathfinding Project by Aron Granberg"
}

I placed mine in Assets/AstarPathfindingProject simply so I didn’t catch anything not related (e.g. JetBrains plugin). I also ensued I didn’t have the examples in there.

The only hitch when using it was EditorResourceHelper not finding the Editor resources but it’s a reasonably simple fix right above the existing if (!found) arond line 78.

        if (!found) { // try package
          try {
            if (!string.IsNullOrEmpty(System.IO.Path.GetFullPath(PackageEditorAssetPath))) {
              editorAssets = PackageEditorAssetPath; // AssetDatabase.LoadAssetAtPath() knows how to resolve this.
              return true;
            }
          } catch (System.Exception) {
            // ignored -- fall through to error below
          }
        }

I don’t believe this will affect those not using as a package at all.

Pathfinding in a package-using project seems to work so I’ll post this now and update it if I find any issues.
HTH, @Arakade