Fix not being able to use package via Unity Package Manager.
Details
When installing package via git following warnings are shown in editor console:
Script 'Packages/com.github.siccity.serializablecallback/Attributes/TargetConstraintAttribute.cs' will not be compiled because it exists outside the Assets folder and does not to belong to any assembly definition file.
UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget, String[])
...
Script 'Packages/com.github.siccity.serializablecallback/Test.cs' will not be compiled because it exists outside the Assets folder and does not to belong to any assembly definition file.
UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget, String[])
This is caused by missing assembly definition files in the repository. Following steps are done:
Created Runtime folder and moved all non-editor code there (this follows Unity package layout convention) e1e5f9a3efe6d2027a3f647c6b506ab812b5a4d7
Created assmebly definition files for Editor and Runtime folders 9c5e3bf94af645b6dc4835fb5a74fc613a173260
Bonus fix: added package author info f1d8774c7937a83afee9282dff223e03d3669f8b
Open Unity project, check no warnings are shown after package import and check package code can be used.
Things to consider
Moving package code from global namespace can be beneficial in the long run to avoid name clashes. Though to use the package one should add using directive to their source code.
Summary
Fix not being able to use package via Unity Package Manager.
Details
When installing package via git following warnings are shown in editor console:
This is caused by missing assembly definition files in the repository. Following steps are done:
Runtime
folder and moved all non-editor code there (this follows Unity package layout convention) e1e5f9a3efe6d2027a3f647c6b506ab812b5a4d7Editor
andRuntime
folders 9c5e3bf94af645b6dc4835fb5a74fc613a173260How to test
Add package to
Packages/manifest.json
as follows:Open Unity project, check no warnings are shown after package import and check package code can be used.
Things to consider
Moving package code from global namespace can be beneficial in the long run to avoid name clashes. Though to use the package one should add
using
directive to their source code.Closes #19