Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

The type or namespace name 'Entities' does not exist in the namespace 'Unity' (are you missing an as

Discussion in 'Entity Component System' started by RoughSpaghetti3211, May 10, 2019.

  1. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,697
    Just upgraded my project to 2019 and jump on ECS. Ive installed all the packages but seeing missing assembly reference error. Please help, makes no sense

    The type or namespace name 'Entities' does not exist in the namespace 'Unity' (are you missing an assembly reference?)

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using Unity.Entities;
    4. using Unity.Rendering;
    5. using Unity.Transforms;
    6. using UnityEngine.SceneManagement;
    7.  
    8. namespace Test.HexSphereECS
    9. {
    10. bootstrapECS
    11.     {
    12.         [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    13.         public static void Init()
    14.         {
    15.         }
    16.     }
    17. }
    18.  
    19.  
     
    Last edited: May 10, 2019
    loxer1337 likes this.
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    Can you show screenshot, with installed Entities in Package Manager? It works for me, so unless you installed something different by accident, restarting Unity may help?
     
  3. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,697
    Here is what i have
    Screen Shot 2019-05-10 at 12.07.19 AM.png
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    That looks indeed fine. In wore case, trying to 1 preview 30 of entities.

    Does same happens after VS and Unity restart?
     
  5. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,697
    Restarting both did not work, Im stumped here
     
  6. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,697
    Wait l found ScriptsAssembly.asmdef in my main scripts folder, will this break it
     

    Attached Files:

    Last edited: May 10, 2019
  7. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    It shouldn't, as long it has dependencies assigned correctly.

    Try remove it, or move script away from, to parent folder, and see if it works.
     
    RoughSpaghetti3211 likes this.
  8. JJJohan

    JJJohan

    Joined:
    Mar 18, 2016
    Posts:
    214
    Your assembly definition needs to reference the Entities package. I don't know if the 'Auto Referenced' property is meant to do this for you but I've always had to manually link in the packages I use if I'm working with assembly definitions.
     
  9. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,697
    Thanks Guys that worked Screen Shot 2019-05-10 at 12.34.52 AM.png
     
    LexSheyn and Antypodish like this.
  10. idurvesh

    idurvesh

    Joined:
    Jun 9, 2014
    Posts:
    495
    I am facing the same issue, wherez assembly def references?
     
    loxer1337 likes this.
  11. VikingThunderFunk

    VikingThunderFunk

    Joined:
    Aug 26, 2020
    Posts:
    1
    I had the same issue, which I curcumvented differently, as I couldn't "manually link in the packages I use" as JJJohan mentioned above.

    Here's my fix. Navigate to your manifest.json (typically under UnityProjects->PROJECTNAME->Packages->manifest) and add the following after your dependencies.

    {
    "dependencies": {
    // JSON removed for clarity
    },
    "registry": "https://packages.unity.com",
    "testables": [
    "com.unity.collections",
    "com.unity.entities",
    "com.unity.jobs"
    ]
    }

    You can also be checking the dependencies section to ensure the packages are actually present.
     
  12. sk_17

    sk_17

    Joined:
    Dec 7, 2023
    Posts:
    1
    I had the same issue. For me the classes and files where not added automatically to the assembly definition. The mistake I made was apparently, that I created the definition file inside the Rider IDE. I was able to see this when I switched to the solution view inside Rider.

    When I create the definition in the unity Editor it correctly added all files to the assembly definition.
     
  13. HRZhang001

    HRZhang001

    Joined:
    Apr 1, 2022
    Posts:
    3
    Dont contain *.Unity.* in your namespace.