Summary
If your project or a third-party plugin declares common names that Unity IAP 5.x also uses (for example, a top-level namespace named “Store,” or classes/namespaces like “Product” or “AppleAppStore”), the C# compiler can collide with IAP’s symbols and fail to compile.
Typical symptoms
- CS0118: “‘Store’ is a namespace but is used like a type”
- CS0104: “‘Product’ is an ambiguous reference”
- CS0433: “Type ‘X’ exists in both ‘AssemblyA’ and ‘AssemblyB’”
Why this happens
- Unity IAP 5.x introduces or expands public types that use short, generic names (such as the
Storeenum or theProductclass). - If your code or a third-party plugin exposes the exact same names at the global root of your project, the compiler may resolve your symbols where the IAP package expects its own.
-
Assembly Definition files (.asmdef) with the “Root Namespace” set to a generic value like “Store” implicitly create that namespace across the entire assembly. This can trigger collisions even if no individual
.cssource file explicitly declares it.
How to check
- Use your IDE (Visual Studio, Rider, etc.) to perform a Global Search (Find in Files). Important: Ensure your search scope is set to "Entire Solution" so you do not miss downloaded assets or third-party plugins.
- Search for:
namespace Store- Types or namespaces named
Product,AppleAppStore, or other names mentioned in the compile error.
- Inspect your
.asmdeffiles and verify the “Root Namespace” is not set to “Store” or other generic names. - Look at the very first compile error in the Unity Console; it typically names the exact symbol that is colliding.
Note: Do not rely on simple C# Reflection scripts (like Assembly.GetExecutingAssembly()) to find these, as they will only scan the specific assembly they are attached to and will miss third-party code.
How to fix
- Rename generic namespaces and types to project-specific names (for example, include your company or game prefix:
MyGameStoreorInventoryProduct) so they don’t collide with IAP. - Set distinctive “Root Namespace” values in your
.asmdeffiles. - If a third-party plugin is the source, update it, configure it to use a unique namespace, or scope its Assembly Definition appropriately (for example, exclude it from player builds if it is an Editor-only tool).
- Where practical in your own code, reference IAP types using their fully qualified namespace (e.g.,
UnityEngine.Purchasing.Product) to avoid ambiguity.
Notes
- Deleting the
Libraryfolder or reimporting assets will not resolve name collisions; you must change the conflicting names or namespaces in the code. - If you temporarily downgraded IAP to an earlier version to continue development, you should still address the naming conflict before returning to IAP 5.x.
Still need help?
Feel free to reach out to the Unity Support team if you have any further questions!