Unable to access Using Pathfinding;

Hi

Are you using assembly definition files by any chance? If so you need to add the A* Pathfinding Project assembly definition file as a dependency in order to use it.

Can you explain what you mean by assembly definition files? I downloaded the project from the site, went into unity and imported package.

Hi

If you don’t know, then you are probably not using them (but see https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html).

So if you write “using Pathfinding;” in some script, what exact error message does Unity give you?

I am not using assembly definition files. Unity is not giving me an error, visual studio cannot find the project. Attached is the error in Visual Studio.

Typically, the import of the scripts into the Unity project are handled when the package is imported; I’ve never run into this issue where the imported package isn’t automatically integrated into the Unity project. Attached is an image of my visual studio hierarchy. The _scripts folder is the container of the code I’ve written, and the other folders are associated with projects I have purchased and installed that have been integrated into my project automatically. Capture Does this make sense?

Hi

I’m not sure what could be causing that.
You could try to delete the .asmdef files in the AstarPathfindingProject folder and rebuild the visual studio project. Unity should have updated your VS project to add the pathfinding scripts as a separate subproject, not sure why that is not happening.

If that does not work am I able to refund the product?

Afish double check that the imported A* package is in /Assets folder in your project, and that it is NOT under Editor folder in any of it’s hierarchies.

It’s not really problem with the package in my opinion, but with the setup of your project. You can also try to delete the ‘Library\ScriptAssemblies’ folder to force rebuild of your assemblies.

1 Like

Thanks for the reply rast. The package is indeed within the /Assets folder. I would be inclined to agree that it could be an issue with the setup of my project, however I have imported separately purchased packages the exact same way and not encountered this issue in the past.

I also went ahead and created a brand new, empty project and imported the package and ran into the same issue. When I get home I’ll attach a screenshot of the project hierarchy, it could very well be an issue I’m unaware of within the hierarchy but I don’t believe that it is.

What version of Unity do you use? I just imported package to brand new project in 2018.3.1f and it works fine.

Can you check the references of your csproj if AstarPathfindingProject is attached?
reference

1 Like

I’m at work currently but when I get home I’ll take a look what version I’m running and the references.

Thanks!

I am on Unity version 2017.3.1f1, the site says compatible with anything over 5.2.2 or higher.

Attached is a screenshot showing the project in the /Assets folder, along with a folder called _Scripts with a single script in it called PathTestScript.

I am able to add scripts to gameobjects in my scene, including AstarPathfindingProject scripts as seen here:
image

Upon opening Visual Studio my script has no reference to the AstarPathfindingProject, and I am unable to utilize Using Pathfinding; as a result.

Update! I went ahead and uninstalled visual studio and reinstalled it and that has resolved the issue. I am now able to access Pathfinding. Weird issue, but glad it’s resolved. Thanks for the help.

1 Like

I am having the same problem, however reinstalling visual studio didn’t fix it for me. I’m on Unity 2019.3.12f1 and I found that deleting the .asmdef files (like aron_granberg said earlier) would let me access Pathfinding, but would cause errors that would make it where I can’t play the game. I tried rebuilding afterwords but that didn’t fix the issue (granted I might have done it wrong).

Any suggestions on how to fix this? I am completely stumped.

Thanks

2019.3.12 seeems to have some bug in it. Several other users have also reported this. Try using Unity 2019.3.10 or 2019.3.13 instead.

1 Like

I didn’t know about the bug. I just updated and its working. Thank you for the help :slight_smile:

Hey, I ran into this issue and deleting my .asmdef totally borked my project too. Any suggestions on how to fix this?

Update: I tried using Clean/Build/Rebuild project options from within Visual Studio to no avail. Then I tried re-importing the .asmdef from the A* package and now the errors are gone but I can’t access anything while using Pathfinding; surely I’m missing something.

Update2: Forgot to include that I’m using Unity 2020.1.11f1

Yo, what’s up. I have found my solution. First of all, you DONT’T want to open your visual studio by selecting script in Unity packages(file explorer). You must go to your File explorer and find your game folder and find “yourprojectname”.sln (Visual Studio Solution) and open it.

If there is no file like that go to your opened unity project, On the left top corner click Edit, go to Preferences and go to External Tools then change External Script Editor to Visual Studio and it should generate all the files you need. After that go to your project folder and double click yourprojectname".sln (Visual Studio Solution) problem gone.

If there is go to your opened unity project, On the left top corner click Edit, go to Preferences and go to External Tools then change External Script Editor to Visual Studio chack all Generate .csproj files for:… and click Regenerate project files.
If that didn’t solve the issue, delete all .scproj files


and click Regenerate project files in External Script Editor

2 Likes

Had the same issue today after importing the asset. I tried most of the suggestions here without success. In the end the simple solution was to go into Edit/Preferences…/External Tools (make sure your External Script Editor is set to Visual Studio) and click on “Regenerate project files”, then I had to click into VS IDE once and it loaded everything and “using Pathfinding” worked.

1 Like

I had a similar problem and after several hours of trying and google searching I moved the modified (and inherited) topdownengine source file from the assets / topdownengine / … folder to the assets / scripts folder and everything started working.

If anybody is still having the issue where PackageTools doesn’t show up in your assembly list when you try to add it (I was on both Unity 2021.2.8f and after upgrading to Unity 2021.2.16f) here’s a solution:

  1. Install Search Everything (https://www.voidtools.com/) An amazing tool, use it :slight_smile:
  2. Open Search Everything and search for “packagetools.asmdef”. That should show you both the path where the package is installed in Unity and in your project’s Library folder. For instance: (C:\Users\david\AppData\Local\Unity\cache\packages\arongranberg.com\packages\7415c0e8b91dfea70e3ae77547ee353d63125d5a9cd4c\com.arongranberg.astar@4.3.56\PackageTools\PackageTools.asmdef)
  3. Open the PackageTools.asmdef.meta file with your favorite text editor (I used Notepad++)
  4. The second line should be something along the lines of:
    guid: f4059aaf6c60a4a58a177a2609feb769
  5. Copy the guid part (select f4059aaf6c60a4a58a177a2609feb769 and ctrl+c)
  6. In Unity, double-click to open your project’s .asmdef file in Visual Studio. If this doesn’t work, you can right-click that file, select “Show in Explorer” and open it with your favorite text editor.
  7. Add a line under the “references” json section of the form:
    “GUID:f4059aaf6c60a4a58a177a2609feb769”
    IMPORTANT: You’ll need a comma at the end of the previous line.
    My ‘references’ block looks like so:
    "references": [
        "GUID:1491147abca9d7d4bb7105af628b223e",
        "GUID:3b8ed52f1b5c64994af4c4e0aa4b6c4b",
        "GUID:e4ee367787d95d546a38c2d316861fb5",
        "GUID:2665a8d13d1b3f18800f46e256720795",
        "GUID:d8b63aba1907145bea998dd612889d6b",
        "GUID:6bb4f13810e2f7e4eae3ddad3ab89777",
        "GUID:185340934ce1fe54a96b79b146acf2a3",
        "GUID:75469ad4d38634e559750d17036d5f7c",
        "GUID:73106583b323919458c1e05166706ce3",
        "GUID:4c25c05f410a3a447a75c3b0909152ef",
        "GUID:8d9e84799a3968d4ba38c55892d14093",
        "GUID:b3ce3b1a5e761c648944bc4f7dfeaa09",
        "GUID:de4e6084e6d474788bb8c799d6b461eb",
        "GUID:efa45043feb7e4147a305b73b5cea642",
        "GUID:f4059aaf6c60a4a58a177a2609feb769"
    ],

NOTE the last entry is the same GUID in the second line of the PackageTools.asmdef.meta file.
8. Save your project’s ASMDEF file and return to Unity. The change should be picked up, your solution and project files regenerated and reloaded, and VOILA!

Hope this helps!

2 Likes