Home

Awesome

CodeSmile AssetDatabase

Imagine Unity's AssetDatabase were self-explanatory, enjoyable to use, consistent in design and behaviour, well documented, prevents disasters, and results in concise code.

Bam, here it is! :)

Click the image to watch the video:

Watch Intro

Get it on the Asset Store

Why did I create this?

The AssetDatabase is heavily fragmented into verbosely named, losely related static methods with inconsistent signatures and varying side-effects. It's functional, but it's design is fundamentally broken (absent), leading to terrible code written against it.

Developers commonly employ a trial-and-error approach. Trivial tasks take much longer than estimated. Edge-cases remain to be discovered later. There is a real risk of data loss due to a simple mistake. Cargo-cult and copy-pasta programming needlessly degrade editor performance.

That's what most editor tools are based on, unfortunately.

You'll find such bad examples even in popular Asset Store tools used by big game studios!

A clean start with a consistent API is the best way to solve these issues, speed up development of editor tools, ensure scripts will not fail for users or other editor platforms.

Write fail-safe, readable, concise, efficient asset scripts in less time. That is what CodeSmile AssetDatabase provides.

Main Features

The main class is CodeSmileEditor.Asset which provides a static API but it's also instantiable.

The Asset instance provides access to asset-specific operations and alleviates you from managing separate state (eg asset path, GUID, sub assets, etc).

The CodeSmileEditor.Asset.Path handles asset paths, ensures they are relative and compatible across editor platforms, validates correctness in regards to file system and assets, and provides all path operations and representations (.meta, full path, etc).

Unity's AssetDatabase and existing scripts using it are NOT altered or affected in any way.

BONUS: Asset Inspector - view and inspect every (!) detail of selected assets. It also serves as a showcase for CodeSmile AssetDatabase.

There's a whole lot more so be sure to explore and discover!

Example Code Snippets

Load and Create assets:

Notice the hands-free, does-what-you-need approach.

What's not noticable here is that any non-existing folder in the path is automatically created. Countless asset scripts fail the first time an actual user runs it. I know YOU know it! You read this far! ;)

Other file operations:

Type conversion:

Asset.Path examples:

Performance:

Work with Sub-Assets:

You'll commonly get or set dependencies, importers, labels, paths, asset bundles, etc. via instance properties.

Complete:

You'll also find Cache Server, Version Control, etc. in well-defined, logical places.

Error Handling:

Exceptions are also thrown for malformed input to make the API more resilient and reliable, rather than calls silently failing or printing unhelpful console logs.

Documentation & Support

The API documentation is more complete with more details and caveats mentioned than Unity's. Of course you'll find these snippets right in your IDE as tooltips.

The Transition Guide helps experienced developers find what each AssetDatabase method maps to in the CodeSmileEditor.Asset class.

If there's anything out of the ordinary, report an issue or contact me. I also have a Discord channel.

You can get the most up-to-date version on the CodeSmile AssetDatabase GitHub repository.

Installation

This software is a Unity Package Manager 'npm package' available on GitHub (GPL License) or the Unity Asset Store (UAS EULA).

Requirements

Licenses

This software is dual-licensed.

FREE => GPL License

The free GitHub version is distributed under the GNU General Public License v3.0 (GPL 3.0). The main implication is that any work you publish that uses this software requires the entire work to be published as open source software under the same GPL 3.0 license.

PAID => Unity Asset Store EULA

The paid version is available on the Unity Asset Store (UAS) and licensed under the Asset Store EULA. Users who purchased this software can, at any time, also download the software from GitHub and use it under the terms and conditions of the Asset Store EULA.

What to expect from me?

I care. A lot.

I work obsessively.

I follow best practices.

I like to share knowledge.

I'm also deeply honest. And I trust you.

I support you.

Support, Feeback, Inquiries

Very welcome!

If you wish to license this software under different terms, for example to create Asset Store tools, please contact me!

I'm available for consultation, tutoring best practices, sharing my experience and other contract work.

If you like this asset and want to support my work please favorite, rate and review this asset! It helps a lot to bubble up in the search algorithm.