Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Compiler not recognizing a Unity-provided namespace

Discussion in 'Code Editors & IDEs' started by cloneshipdom, May 20, 2022.

  1. cloneshipdom

    cloneshipdom

    Joined:
    May 18, 2022
    Posts:
    2
    When the Unity program auto-compiles my scripts, it gives the error:
    error CS0234: The type or namespace name 'Physics2DModule' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

    The line of code in question:
    using UnityEngine.Physics2DModule;

    Physics2DModule is a namespace in UnityEngine, of course. I don't know how to investigate this because I don't know how Unity is compiling the code, where the library is, etc.
    A related pop-up I saw in VS Code that I think might be related: "Failed to find up to date dotnet cli on the path."
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,346
    Physics2DModule is not a namespace in UnityEngine.

    The things inside the module Physics2DModule is namespaced just as UnityEngine, at least in 2021. So eg. AnchoredJoint2D is located in UnityInstall\Editor\Data\Managed\UnityEngine\UnityEngine.Physics2DModule.dll, and you can remove it from the project by removing the Physics2dModule from the package manager's built-in packages, but that doesn't have anything to do with the namespace.