Skip to content

Commit

Permalink
Conforms to upm package.
Browse files Browse the repository at this point in the history
  • Loading branch information
favoyang committed Jun 30, 2019
1 parent 6b89e79 commit d8931af
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Assets/AssetStoreTools*

# Visual Studio cache directory
.vs/
.vscode/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions AddressableImporter.meta → CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Documentation~/AddressableImportSettings-Insepctor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions Documentation~/AddressableImporter.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion AddressableImporter/Editor.meta → Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions Editor/Unity.AddressableImporter.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -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": []
}
7 changes: 7 additions & 0 deletions Editor/Unity.AddressableImporter.Editor.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
37 changes: 15 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
7 changes: 7 additions & 0 deletions package.json.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d8931af

Please sign in to comment.