5

I'm getting this error while building the game.

Could not load file or assembly 'UnityEngine.Purchasing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

Screenshot of the console:

enter image description here

I'm new at Unity and trying to run existing source code.

Programmer
  • 121,791
  • 22
  • 236
  • 328
Swapon
  • 409
  • 6
  • 16
  • I shared my case here. The same reason what I met and solved https://stackoverflow.com/a/74976079/713101 – Phuc Jan 01 '23 at 17:12

2 Answers2

7

Error is caused by UnityPurchasing and this is a bug that occurs sometimes.

1.Go to Windows --> Services or Ctrl+0 and it should open a tab.

2.Sign in on that tab.

3.Finally, enable the Unity services that you're using after signing in.

In your case, I see UnityEngine.Purchasing.ProductCatalog in the error log and this means that you're using the "In-App Purchasing" service. So, enable the "In-App Purchasing" service in the Service tab.


If you still have issues, do the following:

1.Go to the <ProjectDirectory>/Assets/Plugins path

2.Delete the UnityPurchasing folder. You may have many error but just ignore it.

3.Restart the Editor.

4.Open Windows --> Services then sign in again. Re-enable the services.

Programmer
  • 121,791
  • 22
  • 236
  • 328
0

You need to set the JAVA_HOME variable to the JDK install folder If the problem still persist try installing Unity 5.4 version as this bug is not present in that version