Script for creating a unitypackage

If possible I’d like to create an editor script that puts together certain assets/folders into a .unitypackage file. Can this be automated using scripting?

You can use AssetBundles for that…

Making a package from script sounds interesting, though.