Missing references in Visual Studio in new project after import

Greetings,

Since I am somewhat a beginner at Unity, this could simply be a novice error due to experience, but bear with me, as I have some very clear instructions that I feel should work:

I am trying to use the free version of A* Pathfinding together with Unity and Visual Studio:

  • A* Pathfinding 4.2.15
  • Unity 2019.3
  • Visual Studio 2019

Here’s what I do:

  1. Create a new Unity 2019.3 project with 2D template.
  2. Create a new Scripts folder and place a new test script in it.
  3. Run the project and confirm it works as expected.
  4. Import the A* Pathfinding 4.2.15 package available here (https://www.arongranberg.com/astar/download)
  5. Confirm that you can still run the project in the Unity Editor (you can).
  6. Now, open up the script file in Visual Studio 2019 through the Unity Editor as you would with any other file.
  7. Observe the following:
    • You can no longer “Attach to Unity”. If attempted Visual Studio will complain about some 404 errors originating from the Editor-related projects.
    • If you try to reference any classes in the AstarPathfindingProject (non-editor project), the reference cannot be resolved.
    • If you unload (in Visual Studio) the two editor-related projects, you can “Attach to Unity”, but the class references from the AstarPathfindingProject still cannot be found.
    • NOTE: That while I may be a newbie at Unity, I am a well-versed C# programmer, so the cause is not some stupid, “are you missing a using-statement”-level thing.

Now, with that being said, I have actually managed to get it working, but in a very non-satisfactory way: If I create an “Assembly Definition Reference” in the Scripts folder and point that reference to the AstarPathfindingProject, it will now resolve the class reference and ALL errors in the Visual Studio 2019 dissapears. Happy days. Exactly what I want, except that is not gonna work in the long run since I can only add one “Assembly Definition Reference” in that folder.

To note, you would think that if it worked to add an “Assembly Definition Reference” to A*, then it should also work if you simply added an “Assembly Definition” in the Scripts folder and then add a reference to “AstarPathfindingProject” in that. But it does not. If you do that you get exactly the same errors in Visual Studio, except your project is now no longer named “Assembly-CSharp”, but instead whatever name you used in the “Assembly Definition”.

Can anyone shed some light on this, because I am at my wits end and I certainly don’t think it is easy to find any information on this error. But it feels I must be doing something simply wrong because of how easy it is to reproduce.

By the way, I saw there were some other topics on missing references as of late, but none of these solved the issues I was having.

Hi! Just wanted to add that I found another (also somewhat undesirable), but at least workable solution.

If I remove/disable all ASMDEF files everything works. Due to my inexperience I am not quite sure what the consequences of this are, but I don’t feel like it should be necessary.

It seems to be a problem with the newest version of Unity. Try using an older version. Using 2019.3.10 worked for us and solved this issue.

1 Like

Hello,

Thanks a lot of the reply. To be more specific about the version I was ussing then it is 2019.3.12f, so that would probably be affected as well.

I will give a response back here once I find some time to downgrade the project to an earlier version.

Also confirming that upgrading to 2019.3.13 solves the problem. Whew!

1 Like

Hah. So I could just have upgraded to the latest version all along. Can confirm as well.

Thanks for the help.

1 Like