Unity3d reference issue with C # projects

In my Unity project, I have 3 visual studio projects: Build-CSharp-vs Build-CSharp-FirstPass-vs Build-CSharp-editor against

All my scripts seem to fall into Assembly-CSharp-firstpass-vs, but the imported asset that I use (2dtoolkit) has code in Assembly-CSharp-vs ... This means that I cannot access this code from Assembly-CSharp-firstpass-vs, because there is no reference to Assembly-CSharp-vs (there should not be a link in this way).

So what is the โ€œrightโ€ way to handle this? I believe that either I should move my script files to Assembly-CSharp-vs, or I should transfer my asset sources to Assembly-CSharp-firstpass-vs ..

+6
source share
1 answer

If your scripts fall into the Assembly-CSharp-firstpass-vs project, it means that somewhere up in the folder hierarchy you have a folder named "Plugins", "Standard Assets" or "Pro Standard Assets". This forces you to compile scripts in the first of 4 possible compilation steps. Therefore, Unity will put your code files in the Assembly-CSharp-firstpass-vs project.

To access 2DToolkit from your code, I would recommend that you move all your script files so that they are not placed under any of these folders. This will lead to their placement in the Assembly-CSharp-vs project.

If you use C #, it should work now. But if you wrote your own code in UnityScript (JavaScript) or Boo, you will need to place the 2DToolkit in a folder called Plugins (either "Standard Assets" or "Pro Standard Assets" if you prefer this), so it compiles before your code .

Take a look at the Script compilation page in the Unity manual for more details on how you can control the script compilation order.

+4
source

Source: https://habr.com/ru/post/919558/


All Articles