CodeSmile AssetDatabase 1.9
Unity's AssetDatabase in enjoyable, consistent, concise, convenient, comprehensible, safe, documented form.
Loading...
Searching...
No Matches
Asset Class Referencesealed

Replacement implementation for Unity's massive AssetDatabase class with a cleaner interface and more error checking. Asset is instantiable so you can work with assets like you do with UnityEngine.Object. In fact, Asset is essentially a wrapper around the asset's UnityEngine.Object (see: MainObject). More...

+ Collaboration diagram for Asset:

Classes

class  Bundle
 Groups all asset bundle related functionality. More...
 
class  Database
 Groups all asset database functionality. More...
 
class  Dependency
 Groups all dependency related functionality. More...
 
class  File
 Groups file related operations. More...
 
class  Importer
 Groups all AssetImporter related functionality. More...
 
class  Label
 Groups all asset label related static methods. More...
 
class  Package
 Groups import/export functionality for .unitypackage files (Asset Packages). More...
 
class  Path
 Represents a relative path to an asset file or folder, typically under 'Assets' or 'Packages'. More...
 
class  Status
 Groups asset status related functions. More...
 
class  SubAsset
 Groups all Sub-Asset related functionality. More...
 
class  ThrowIf
 Contains error- and sanity-checking methods for the entire Asset group of classes.
 
class  VersionControl
 Groups version control related functionality. More...
 

Public Member Functions

 Asset (Byte[] contents, Path path, Boolean overwriteExisting=false)
 Creates an asset file from a byte array.
 
 Asset (GUID assetGuid)
 Loads the asset using its GUID.
 
 Asset (Object asset)
 Uses an existing asset reference.
 
 Asset (Object asset, Path path, Boolean overwriteExisting=false)
 Creates an asset file from an existing UnityEngine.Object instance.
 
 Asset (Path path)
 Loads the asset at path.
 
 Asset (String contents, Path path, Boolean overwriteExisting=false)
 Creates an asset file from a string.
 
void AddLabel (String label)
 Adds a label to the asset.
 
void AddLabels (String[] labels)
 Adds several labels to the asset.
 
void AddSubAsset (Object instance)
 Adds an object as a sub-object to the asset. The object must not already be an asset.
 
Boolean CanMove (Path destinationPath)
 Tests if a Move operation will be successful without actually moving the asset.
 
Boolean CanOpenInEditor ()
 Returns true if the asset can be opened (edited) by the Unity Editor itself.
 
void ClearLabels ()
 Removes all labels from the asset.
 
Object Delete ()
 Deletes the asset file.
 
Asset Duplicate ()
 Creates a duplicate of the asset with a new, unique file name.
 
void ExportPackage (String packagePath, ExportPackageOptions options=ExportPackageOptions.Default)
 Exports this asset and its dependencies as a .unitypackage.
 
void ForceSave ()
 Saves the asset to disk, regardless of whether it is marked as 'dirty'.
 
GetMain< T > ()
 Gets the main object cast to T.
 
Load< T > ()
 Loads a (sub) object from the asset identified by type.
 
Boolean Move (Path destinationPath)
 Moves asset to destination path.
 
void OpenExternal (Int32 lineNumber=-1, Int32 columnNumber=-1)
 Opens the asset in the external (associated) application.
 
void RemoveLabel (String label)
 Removes a label from an asset. Does nothing if the label doesn't exist.
 
void RemoveSubAsset (Object subAsset)
 Removes an object from the asset's sub-objects.
 
Boolean Rename (String newFileName)
 Renames an asset's file name (without extension) or a folder.
 
void Save ()
 Saves any changes to the asset to disk.
 
Asset SaveAs (Path path)
 Saves a copy of the asset to a new path. Overwrites any existing asset at path.
 
Asset SaveAsNew (Path path)
 Saves a copy of the asset to a new path. Generates a unique file/folder name if path already exists.
 
void SetDirty ()
 Marks the main object as dirty.
 
void SetLabels (String[] labels)
 Sets the asset's labels, replacing all previously existing labels.
 
Object Trash ()
 Moves the asset to the OS trash. Same as Delete, but recoverable.
 

Static Public Member Functions

static Texture2D GetIcon ([NotNull] Object asset)
 Returns the icon associated with the asset type.
 
static Texture2D GetIcon ([NotNull] Path path)
 Returns the icon associated with the asset type.
 
static String GetLastErrorMessage ()
 Returns the last error message returned by some methods that provide such a failure message.
 
static implicit operator Asset (GUID guid)
 Implicit conversion of GUID to an asset instance.
 
static implicit operator Asset (Object asset)
 Implicit conversion of UnityEngine.Object to an Asset.
 
static implicit operator Asset (Path path)
 Implicit conversion of Asset.Path to an Asset instance.
 
static implicit operator Asset (String path)
 Implicit conversion of string path to an asset instance.
 
static implicit operator Object (Asset asset)
 Implicit conversion to UnityEngine.Object.
 

Properties

Type ActiveImporter [get, set]
 Returns the active AssetImporter type for this asset.
 
Path AssetPath [get]
 Returns the path to the asset (file or folder).
 
Type[] AvailableImporters [get]
 Returns the available importers for this asset.
 
Type DefaultImporter [get]
 Returns the default AssetImporter type for this asset.
 
String[] Dependencies [get]
 Returns the assets' direct and indirect dependencies (recursive).
 
String[] DirectDependencies [get]
 Returns the assets' direct dependencies.
 
Int64 FileId [get]
 Returns the local FileID of the asset.
 
GUID Guid [get]
 Returns the asset's GUID.
 
Texture2D Icon [get]
 Returns the icon texture associated with the asset type.
 
Boolean IsDeleted [get]
 Returns true after the asset has been deleted.
 
Boolean IsForeign [get]
 Returns whether this is a foreign asset.
 
Boolean IsImporterOverridden [get]
 Returns true if the asset's default AssetImporter type has been overridden.
 
Boolean IsNative [get]
 Returns whether this is a native asset.
 
Boolean IsScene [get]
 Returns true if this is a scene asset.
 
String[] Labels [get, set]
 Sets or gets the labels associated with the asset.
 
Object MainObject [get, set]
 Gets or sets the asset's main object.
 
Type MainObjectType [get]
 Returns the type of the main asset at the given path.
 
Path MetaPath [get]
 Returns the path to the .meta file for the asset.
 
String OwningBundle [get]
 Returns the bundle name the asset belongs to.
 
String OwningBundleVariant [get]
 Returns the bundle variant name the asset belongs to.
 
Object[] SubAssets [get]
 Loads and returns all sub objects the asset is comprised of.
 
Object[] VisibleSubAssets [get]
 Loads and returns only those asset objects that are shown in the project view.
 

Detailed Description

Replacement implementation for Unity's massive AssetDatabase class with a cleaner interface and more error checking. Asset is instantiable so you can work with assets like you do with UnityEngine.Object. In fact, Asset is essentially a wrapper around the asset's UnityEngine.Object (see: MainObject).

Definition at line 10 of file Asset.Bundle.cs.