- Home /
Custom Package Editor Script
Good morning,
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: https://www.file-upload.net/download-13602273/TestPackage.zip.html
Answer by RedHillbilly · Feb 16, 2020 at 09:14 PM
Had the same problem, found the solution here: https://forum.unity.com/threads/case-1086863-component-script-cannot-configure-anymore-after-converting-into-embedded-package.563725/
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.
Answer by Sonic1584 · Dec 18, 2019 at 02:48 PM
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. https://fogbugz.unity3d.com/default.asp?1204133_32l912gfq43a7kq2