Wednesday, November 19, 2014

Unity Full Project Export

I tweak, patch and update many of the assets I purchase / download from the Asset Store. When creating packages (exports) I struggled to create an export that included the "Project Settings" folder where nifty things like the TagManager, LayersManager and InputManager all reside. Sure the old method of zipping up the folder and placing the .zip file inside the Assets folder would work but was extremely clunky.

A quick search on the Unity Answers section led me to an Editor based(1) script that would create a full project export; including the Settings folder. Sweet!

Here is the script, in all its glory!

using UnityEditor;
using UnityEngine;

public class FullExport : MonoBehaviour {


    [MenuItem("Tools/Full Export")]
    private static void NewMenuOption()
    {
        string fileName = "FullProject_Export.unitypackage";
        AssetDatabase.ExportPackage("Assets"fileNameExportPackageOptions.Interactive | ExportPackageOptions.Recurse | ExportPackageOptions.IncludeLibraryAssets|ExportPackageOptions.IncludeDependencies);
        Debug.Log(fileName + " is located in this projects root folder");
    }
}
To "run" the script, after installing just look at the menubar for "Tools" and then choose "Full Export".



You can download the script already set inside an "Editor" folder which is inside an "_Exporter" folder.


(1) Editor scripts MUST be located inside a folder called "Editor". The folder can be a subfolder AND you can have as many as you want(2) .
(2) Just like the "Resources" folder, they can be scattered through out your project and all will be merged when building your app.

No comments:

Post a Comment