I am using Unity 2019.1.0f2 and trying to create custom packages to be used with the package manager.
Unfortunately, Editor scripts do not seem to work.
When I load all files into the asset folder it works fine, but not when loaded as a package via the package manager.
Any Ideas what could be the problem?
This is my package:
Had the same problem, found the solution here:
Here is the procedure (c.f. image):
- Create an “Assembly definition” file at the root of the “Assets” folder: Create > Assembly Definition
- Create an “Assembly definition” inside your “Editor” folder (Assets>Editor): Create > Assembly Definition
- Refer to your Assembly definition file from your Assembly definition reference file.
- Set the Assembly to only compile in the editor (c.f. image 2)
Once you commit your changes and re-import the package in your other project, everything should work.
If you create or reimport your assembly definition file for the Editor folder in Packages, is there a warning like this?
“Assembly for Assembly Definition File ‘Packages/com.ourcompany.ourfeature/Editor/OurFeature.Editor.asmdef’ will not be compiled, because it has no scripts associated with it.”
It seems to be very important to follow the package layout convention from the Unity docs! This way I could get Editor scripts to compile when importing a local package from disk outside the project.
Anyway, it won’t ever do so when the exact same package was added via git url, though. In this case there is no warning anymore, scripts inside the Editor folder are just not compiled (but other files e.g. in Runtime are ok).
Any suggestions on this?
We already created a bugreport, but unfortunatly without any reply yet.