In my Unity project I have 3 visual studio projects:
Assembly-CSharp-vs
Assembly-CSharp-firstpass-vs
Assembly-CSharp-Editor-vs
All my scripts seems to end up in Assembly-CSharp-firstpass-vs, but an imported asset I’m using (2dtoolkit) has the code in Assembly-CSharp-vs … Which means that I can’t access this code from Assembly-CSharp-firstpass-vs, because there is no reference to Assembly-CSharp-vs (there’s not supposed to be a reference that way).
So, what is the “correct” way to handle this? I imagine that either I must move my script files to Assembly-CSharp-vs, or I must move my asset sources to Assembly-CSharp-firstpass-vs..
If your scripts end up in the Assembly-CSharp-firstpass-vs project, it means that somewhere upwards in their folder hierarchy you have a folder named “Plugins”, “Standard Assets” or “Pro Standard Assets”. This causes you scripts to be compiled in the first of 4 possible compilation steps. So Unity will therefore place your code files in the Assembly-CSharp-firstpass-vs project.
To make it possible to access 2DToolkit from your code I would recommend that you move all of your script files so they are not placed under any of these folders. This will cause them to be placed in the Assembly-CSharp-vs project.
If you are using C# it should work now. But if you have written your own code in UnityScript(JavaScript) or Boo, you will have to place 2DToolkit in a folder named Plugins (or “Standard Assets” or “Pro Standard Assets” if you prefer that) so it compiles before your code.
Take a look at the Script compilation page in the Unity manual for more in-depth information of how you can control the script compilation order.