Skip to content

oxitorenk/BetterPackageImport

 
 

Repository files navigation

BetterPackageImport

Unity Editor extension that imports .unitypackage files into a chosen folder instead of the project root.


Features

Import to Selected Folder

Select any folder in the Project window, then use Assets > Import Package > Here... The file picker opens and the package imports directly into that folder.

Companion Window

When Unity's built-in import dialog opens (from any source — Package Manager, drag-and-drop, menu), a small BetterPackageImport utility window appears beside it.

  • Import to Another Folder — opens a folder picker and rewrites all destination paths in the open dialog
  • Recent folders dropdown — one-click access to the last 5 used import folders, persisted across sessions
  • Target label — shows the currently selected destination

Drag-and-Drop Auto-Redirect

Drop a .unitypackage file directly onto a folder in the Project window. The import dialog opens with all paths already redirected to that folder — no manual selection needed.


Installation

Add via Unity Package Manager using the git URL:

https://github.com/Oxitorenk/BetterPackageImport.git

Or clone/download and place the package folder inside your project's Packages/ directory.


Usage

Interactive import (recommended)

  1. Drag a .unitypackage onto a folder in the Project window dialog opens with paths pre-set to that folder
  2. Review the contents in Unity's import dialog
  3. Click Import

Import via menu

  1. Select a folder in the Project window
  2. Assets > Import Package > Here...
  3. Pick a .unitypackage file

Redirect an already-open dialog

  1. When Unity's import dialog is open, the companion window appears automatically
  2. Pick a destination from the recent folders dropdown or click Import to Another Folder
  3. Paths update live in the dialog — click Import

Scripting API (silent import)

using Oxitorenk.BetterPackageImport;

// interactive = true  → opens Unity's import dialog with redirected paths
// interactive = false → imports silently (no dialog)
PackageImporter.BetterPackageImport(packagePath, "Assets/ThirdParty", interactive: false);

How It Works

All path manipulation goes through reflection against Unity's internal PackageUtility, PackageImport, and ImportPackageItem types (not part of the public API). Each ImportPackageItem.destinationAssetPath is rewritten to point to the chosen folder before import runs.

Paths starting with Packages/ are skipped. The selectedFolderPath must start with Assets.


Notes

  • Editor-only — no runtime code
  • Recent folders stored in EditorPrefs key BetterPackageImport.RecentFolders
  • If Unity renames internal import types in a future version, the extension fails gracefully (logs a warning, does not throw)

About

Allows to import Unity packages into specified folder to avoid your project's root bloating.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • C# 100.0%