diff --git a/.gitignore b/.gitignore index 0210746..bfe8f4f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ Assets/AssetStoreTools* # Visual Studio cache directory .vs/ +.vscode/ # Autogenerated VS/MD/Consulo solution and project files ExportedObj/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cd9ed41 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog +All notable changes to this package will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [0.1.0-preview] - 2019-06-30 + - Initial submission for package distribution diff --git a/AddressableImporter.meta b/CHANGELOG.md.meta similarity index 57% rename from AddressableImporter.meta rename to CHANGELOG.md.meta index 7a2e6bf..5e67658 100644 --- a/AddressableImporter.meta +++ b/CHANGELOG.md.meta @@ -1,7 +1,6 @@ fileFormatVersion: 2 -guid: 5a8cf161d701c784783c071aa7a9c506 -folderAsset: yes -DefaultImporter: +guid: e0291b694a2344f4abc085ebe276fefe +TextScriptImporter: externalObjects: {} userData: assetBundleName: diff --git a/Documentation~/AddressableImportSettings-Insepctor.png b/Documentation~/AddressableImportSettings-Insepctor.png index 6aa1bfc..e115995 100644 Binary files a/Documentation~/AddressableImportSettings-Insepctor.png and b/Documentation~/AddressableImportSettings-Insepctor.png differ diff --git a/Documentation~/AddressableImporter.md b/Documentation~/AddressableImporter.md new file mode 100644 index 0000000..ab21940 --- /dev/null +++ b/Documentation~/AddressableImporter.md @@ -0,0 +1,30 @@ +# Addressable Importer Usage + +You should create a single AddressableImportSettings file located at `Assets/AddressableAssetsData/AddressableImportSettings.asset`. To create it, go to `Assets/AddressableAssetsData` folder, right click in your project window and choose `Create > Addressable Assets > Import Settings`. + +If no settings file exists, an empty one will be created when importing any new asset. + +Once the settings file selected, you can edit rules in the inspector window. Then click `File > Save Project` to apply the changes. + +![AddressableImportSettings Inspector](AddressableImportSettings-Insepctor.png) + +Create a rule +- Path, the path pattern +- Match type + - Wildcard, `*` matches any number of characters, `?` matches a single character + - Regex +- Group name, leaves blank for the default group +- Labels, the labels to add +- Simplified, simplify address to filename without extension + +Rule Examples + +| Type | Example | +|----------|---------------------| +| Wildcard | Asset/Sprites/Icons | +| Wildcard | Asset/Sprites/Level??/*.asset | +| Regex | ^Assets/Models/.*\\.fbx | + +Notices for moved or re-imported assets +- The importer will not override existing labels. +- The importer will only override address if it looks like a path (starts with `Assets/`). In another word, if you changed or simplified the address, then reimport or move it, the address remains no change. diff --git a/AddressableImporter/Editor.meta b/Editor.meta similarity index 77% rename from AddressableImporter/Editor.meta rename to Editor.meta index 4966f23..966cfe1 100644 --- a/AddressableImporter/Editor.meta +++ b/Editor.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0ff6d86e77543ea499e83e52f9f0c827 +guid: 6eae96027cac7c44bb61b85b07167e29 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/AddressableImporter/Editor/AddressableImportRule.cs b/Editor/AddressableImportRule.cs similarity index 100% rename from AddressableImporter/Editor/AddressableImportRule.cs rename to Editor/AddressableImportRule.cs diff --git a/AddressableImporter/Editor/AddressableImportRule.cs.meta b/Editor/AddressableImportRule.cs.meta similarity index 100% rename from AddressableImporter/Editor/AddressableImportRule.cs.meta rename to Editor/AddressableImportRule.cs.meta diff --git a/AddressableImporter/Editor/AddressableImportSettings.cs b/Editor/AddressableImportSettings.cs similarity index 100% rename from AddressableImporter/Editor/AddressableImportSettings.cs rename to Editor/AddressableImportSettings.cs diff --git a/AddressableImporter/Editor/AddressableImportSettings.cs.meta b/Editor/AddressableImportSettings.cs.meta similarity index 100% rename from AddressableImporter/Editor/AddressableImportSettings.cs.meta rename to Editor/AddressableImportSettings.cs.meta diff --git a/AddressableImporter/Editor/AddressableImporter.cs b/Editor/AddressableImporter.cs similarity index 100% rename from AddressableImporter/Editor/AddressableImporter.cs rename to Editor/AddressableImporter.cs diff --git a/AddressableImporter/Editor/AddressableImporter.cs.meta b/Editor/AddressableImporter.cs.meta similarity index 100% rename from AddressableImporter/Editor/AddressableImporter.cs.meta rename to Editor/AddressableImporter.cs.meta diff --git a/Editor/Unity.AddressableImporter.Editor.asmdef b/Editor/Unity.AddressableImporter.Editor.asmdef new file mode 100644 index 0000000..ac91906 --- /dev/null +++ b/Editor/Unity.AddressableImporter.Editor.asmdef @@ -0,0 +1,18 @@ +{ + "name": "Unity.AddressableImporter.Editor", + "references": [ + "Unity.Addressables", + "Unity.Addressables.Editor" + ], + "optionalUnityReferences": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [] +} \ No newline at end of file diff --git a/Editor/Unity.AddressableImporter.Editor.asmdef.meta b/Editor/Unity.AddressableImporter.Editor.asmdef.meta new file mode 100644 index 0000000..00c875a --- /dev/null +++ b/Editor/Unity.AddressableImporter.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6256bdcb0aaf53446b7dd10403a9d748 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/LICENSE.meta b/LICENSE.md.meta similarity index 100% rename from LICENSE.meta rename to LICENSE.md.meta diff --git a/README.md b/README.md index 1744fd7..843fca0 100644 --- a/README.md +++ b/README.md @@ -3,33 +3,26 @@ A simple rule based addressable asset importer. The importer marks assets as addressable, by applying to files having a path matching the rule pattern. -## Usage +## Install package -You should create a single AddressableImportSettings file located at `Assets/AddressableAssetsData/AddressableImportSettings.asset`. To create it, go to `Assets/AddressableAssetsData` folder, right click in your project window and choose `Create > Addressable Assets > Import Settings`. +### Install as a git package -If no settings file exists, an empty one will be created when importing any new asset. +This is the recommended way to track update. Open Packages/manifest.json with your favorite text editor. Add the following line to the dependencies block. -Once the settings file selected, you can edit rules in the inspector window. Then click `File > Save Project` to apply the changes. + { + "dependencies": { + "com.littlebigfun.addressable-importer": "https://github.com/favoyang/unity-addressable-importer.git" + } + } -![AddressableImportSettings Insepctor](./Documentation~/AddressableImportSettings-Insepctor.png) +### Install as an embbed package via submodule -Create a rule -- Path, the path pattern -- Match type - - Wildcard, `*` matches any number of characters, `?` matches a single character - - Regex -- Group name, leaves blank for the default group -- Labels, the labels to add -- Simplified, simplify address to filename without extension +This way gives you more control if you want to modify the package based on your purpose. Fork the repo, and checkout to your Packages folder as submodule. -Rule Examples + git submodule add https://github.com/[YOURNAME]/unity-addressable-importer.git Packages/unity-addressable-importer + git add -A + git ci -m "Imported unity-addressable-importer as embbed package" -| Type | Example | -|----------|---------------------| -| Wildcard | Asset/Sprites/Icons | -| Wildcard | Asset/Sprites/Level??/*.asset | -| Regex | ^Assets/Models/.*\\.fbx | +## How to use -Notices for moved or re-imported assets -- The importer will not override existing labels. -- The importer will only override address if it looks like a path (starts with `Assets/`). In another word, if you changed or simplified the address, then reimport or move it, the address remains no change. +See [usage](./Documentation~/AddressableImporter.md) diff --git a/package.json b/package.json new file mode 100644 index 0000000..81abaef --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "com.littlebigfun.addressable-importer", + "displayName": "Unity Addressable Importer", + "version": "0.1.0-preview", + "unity": "2018.3", + "description": "A simple rule based addressable asset importer.", + "dependencies": { + "com.unity.addressables": "1.1.4" + } +} \ No newline at end of file diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..840876d --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 610ea59e9fa780a48a0cf98536261cb3 +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: