Skip to content

Commit

Permalink
readme once again
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeSmile-0000011110110111 committed Dec 26, 2023
1 parent a7874df commit 1a9c4b6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ Or just being confused, once again, about whether you need to use `AssetDatabase

`data.ActiveImporter = typeof(MyDataImporter);` // Change asset's importer

`data.ExportPackage("I:/leveldata.unitypackage");` // Export as .unitypackage

`var dataObject = data.MainObject;` // Get asset's UnityEngine.Object instance

`var levelData = data.GetAs<LevelData>();` // Get it as specific type (may be null)

`var levelData = (LevelData)data;` // Cast to a type (may throw)

`Asset.File.BatchEditing(() => { /* mass file IO */ });` // Speed up calling many Asset.File.* methods (loop)

`Asset.File.Import(paths);` // Mass import of paths, batched internally

`var obj = Asset.File.Create(str, "Assets/Folder/Data.asset");` // Create (overwrite) asset from string

`var obj = Asset.File.CreateAsNew(bytes, "Assets/Folder/Data.asset");` // Create new asset from byte[]
Expand All @@ -62,6 +50,14 @@ The 'create' methods above cover EVERY ASPECT and edge-cases:

`var actualPath = asset.AssetPath;` // Filename might have changed, eg "Data (3).asset"

`asset.ExportPackage("I:/leveldata.unitypackage");` // Export as .unitypackage

`var obj = asset.MainObject;` // Get asset's UnityEngine.Object instance

`var levelData = asset.GetAs<LevelData>();` // Get it as specific type (may be null)

`var levelData = (LevelData)asset;` // Cast to a type (may throw)

`var subAssets = asset.SubAssets;` // Do I need to keep explaining these calls?

`var assetDupe = asset.Duplicate();` // Because you need a duplicate ..
Expand All @@ -72,6 +68,10 @@ The 'create' methods above cover EVERY ASPECT and edge-cases:

`newAsset.Trash();` // Okay. Either you're bored or excited to work with the AssetDatabase for the first time EVER. :)

`Asset.File.BatchEditing(() => { /* mass file IO */ });` // Speed up calling many Asset.File.* methods (loop)

`Asset.File.Import(paths);` // Mass import of paths, batched internally

`var msg = Asset.GetLastErrorMessage();` // A file operation failed? Show this!

## I don't trust this ..
Expand Down

0 comments on commit 1a9c4b6

Please sign in to comment.