Skip to main content
Bumped by Community user
added 613 characters in body
Source Link

I have built a custom package for Unity called world-renderer. This is the folder structure.

enter image description here

Inside "Runtime" is all my source code. To use it inside a Unity project, I add this line into the manifest.json of that project.

"com.tamagames.extinction.word-renderer": "file:C:/Users/dbugger/projects/unity/world-renderer",

This has worked great so far, but now I want to start using ECS inside my custom package. so I add its namespace to one of the files:

using Unity.Entities;

and now when I return to the Unity Editor, I see the following error message:

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

I figured I needed to add the dependency to the package.json of my custom package, so I wrote updated it like this:

{
  "name": "com.tamagames.extinction.word-renderer",
  "version": "1.0.4",
  "displayName": "Extinction - World renderer",
  "description": "World renderer for Extinction",
  "unity": "2019.1",
  "unityRelease": "0b5",
  "keywords": [],
  "dependencies": {
    "com.unity.entities": "0.1.1-preview" // Dependency added
 },
  "author": {
    "name": "Enrique Moreno Tent",
    "email": "[email protected]",
    "url": "https://enriquemorenotent.com"
  }
}

But I still keep getting the same error.

What am I doing wrong?

UPDATE

I try adding the reference to the Assembly of my package, like this:

{
    "name": "Unity.com.tamagames.extinction.world-renderer-ecs",
    "optionalUnityReferences": ["com.unity.entities"],
    "includePlatforms": [],
    "excludePlatforms": [],
    "allowUnsafeCode": false,
    "overrideReferences": false,
    "precompiledReferences": [],
    "autoReferenced": true,
    "defineConstraints": [],
    "versionDefines": []
}

That did solve the problem with "Unity.Entities" not found, but now, in the Unity Project, the classes inside my source code cannot be found!

I have built a custom package for Unity called world-renderer. This is the folder structure.

enter image description here

Inside "Runtime" is all my source code. To use it inside a Unity project, I add this line into the manifest.json of that project.

"com.tamagames.extinction.word-renderer": "file:C:/Users/dbugger/projects/unity/world-renderer",

This has worked great so far, but now I want to start using ECS inside my custom package. so I add its namespace to one of the files:

using Unity.Entities;

and now when I return to the Unity Editor, I see the following error message:

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

I figured I needed to add the dependency to the package.json of my custom package, so I wrote updated it like this:

{
  "name": "com.tamagames.extinction.word-renderer",
  "version": "1.0.4",
  "displayName": "Extinction - World renderer",
  "description": "World renderer for Extinction",
  "unity": "2019.1",
  "unityRelease": "0b5",
  "keywords": [],
  "dependencies": {
    "com.unity.entities": "0.1.1-preview" // Dependency added
 },
  "author": {
    "name": "Enrique Moreno Tent",
    "email": "[email protected]",
    "url": "https://enriquemorenotent.com"
  }
}

But I still keep getting the same error.

What am I doing wrong?

I have built a custom package for Unity called world-renderer. This is the folder structure.

enter image description here

Inside "Runtime" is all my source code. To use it inside a Unity project, I add this line into the manifest.json of that project.

"com.tamagames.extinction.word-renderer": "file:C:/Users/dbugger/projects/unity/world-renderer",

This has worked great so far, but now I want to start using ECS inside my custom package. so I add its namespace to one of the files:

using Unity.Entities;

and now when I return to the Unity Editor, I see the following error message:

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

I figured I needed to add the dependency to the package.json of my custom package, so I wrote updated it like this:

{
  "name": "com.tamagames.extinction.word-renderer",
  "version": "1.0.4",
  "displayName": "Extinction - World renderer",
  "description": "World renderer for Extinction",
  "unity": "2019.1",
  "unityRelease": "0b5",
  "keywords": [],
  "dependencies": {
    "com.unity.entities": "0.1.1-preview" // Dependency added
 },
  "author": {
    "name": "Enrique Moreno Tent",
    "email": "[email protected]",
    "url": "https://enriquemorenotent.com"
  }
}

But I still keep getting the same error.

What am I doing wrong?

UPDATE

I try adding the reference to the Assembly of my package, like this:

{
    "name": "Unity.com.tamagames.extinction.world-renderer-ecs",
    "optionalUnityReferences": ["com.unity.entities"],
    "includePlatforms": [],
    "excludePlatforms": [],
    "allowUnsafeCode": false,
    "overrideReferences": false,
    "precompiledReferences": [],
    "autoReferenced": true,
    "defineConstraints": [],
    "versionDefines": []
}

That did solve the problem with "Unity.Entities" not found, but now, in the Unity Project, the classes inside my source code cannot be found!

Source Link

Using ECS in a custom Unity package

I have built a custom package for Unity called world-renderer. This is the folder structure.

enter image description here

Inside "Runtime" is all my source code. To use it inside a Unity project, I add this line into the manifest.json of that project.

"com.tamagames.extinction.word-renderer": "file:C:/Users/dbugger/projects/unity/world-renderer",

This has worked great so far, but now I want to start using ECS inside my custom package. so I add its namespace to one of the files:

using Unity.Entities;

and now when I return to the Unity Editor, I see the following error message:

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

I figured I needed to add the dependency to the package.json of my custom package, so I wrote updated it like this:

{
  "name": "com.tamagames.extinction.word-renderer",
  "version": "1.0.4",
  "displayName": "Extinction - World renderer",
  "description": "World renderer for Extinction",
  "unity": "2019.1",
  "unityRelease": "0b5",
  "keywords": [],
  "dependencies": {
    "com.unity.entities": "0.1.1-preview" // Dependency added
 },
  "author": {
    "name": "Enrique Moreno Tent",
    "email": "[email protected]",
    "url": "https://enriquemorenotent.com"
  }
}

But I still keep getting the same error.

What am I doing wrong?