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

Groups file related operations. More...

+ Collaboration diagram for Asset.File:

Classes

class  AssetDatabaseLoadOperation
 

Static Public Member Functions

static void BatchEditing ([NotNull] Action massAssetFileEditAction)
 Batch multiple asset file operations to improve execution speed.
 
static Boolean CanMove ([NotNull] Path sourcePath, [NotNull] Path destinationPath)
 Tests if an asset can be moved to destination without moving the asset.
 
static Boolean CanOpenInEditor ([NotNull] Object instance)
 Returns true if the given object can be opened (edited) by the Unity editor.
 
static Boolean CanOpenInEditor (Int32 instanceId)
 Returns true if the given object can be opened (edited) by the Unity editor.
 
static Boolean Copy ([NotNull] Path sourcePath, [NotNull] Path destinationPath)
 Copies an asset from source to destination path. Overwrites any existing assets.
 
static Boolean CopyAsNew ([NotNull] Path sourcePath, [NotNull] Path destinationPath)
 Copies an asset from source to destination path. Generates a unique file name if an asset already exist at destinationPath.
 
static Object Create ([NotNull] Byte[] contents, [NotNull] Path path)
 Writes the byte array to disk, then imports and loads the asset. Overwrites any existing file.
 
static Object Create ([NotNull] Object instance, [NotNull] Path path)
 Writes the object to disk. Overwrites any existing file.
 
static Object Create ([NotNull] String contents, [NotNull] Path path)
 Writes the string to disk, then imports and loads the asset. Overwrites any existing file.
 
static Object CreateAsNew ([NotNull] Byte[] contents, [NotNull] Path path)
 Writes the byte array to disk, then imports and loads the asset. Generates a unique file name if an asset exists at the path.
 
static Object CreateAsNew ([NotNull] Object instance, [NotNull] Path path)
 Writes the object to disk. Generates a unique file name if an asset exists at the path.
 
static Object CreateAsNew ([NotNull] String contents, [NotNull] Path path)
 Writes the string to disk, then imports and loads the asset. Generates a unique file name if an asset exists at the path.
 
static T CreateOrLoad< T > ([NotNull] Path path, [NotNull] Func< T > getInstance)
 Loads or creates an asset at path.
 
static Boolean Delete ([NotNull] IEnumerable< Path > paths)
 Tries to delete multiple files/folders.
 
static Boolean Delete ([NotNull] IEnumerable< String > paths)
 Tries to delete multiple files/folders.
 
static Boolean Delete ([NotNull] Object asset)
 Deletes an asset file or folder.
 
static Boolean Delete ([NotNull] Path path)
 Deletes an asset file or folder.
 
static String[] Find ([NotNull] String filter, String[] searchInFolders=null)
 Finds asset GUIDs by the given filter criteria.
 
static GUID[] FindGuids ([NotNull] String filter, String[] searchInFolders=null)
 Finds asset GUIDs by the given filter criteria.
 
static Path[] FindPaths ([NotNull] String filter, Path[] searchInFolders=null)
 Finds asset paths by the given filter criteria.
 
static Path[] FindPaths ([NotNull] String filter, String[] searchInFolders=null)
 Finds asset paths by the given filter criteria.
 
static void ForceSave ([NotNull] Object asset)
 Forces the object to be saved to disk. Marks the object as dirty and then calls CodeSmileEditor.Asset.File.Save.
 
static Int64 GetFileId ([NotNull] Object asset)
 Returns the local FileID of the object.
 
static GUID GetGuid ([NotNull] Object asset)
 Returns the GUID of an object. Returns an empty GUID if the object is null or not an asset.
 
static ValueTuple< GUID, Int64 > GetGuidAndFileId ([NotNull] Object asset)
 
static Type GetMainType ([NotNull] Path path)
 
static Type GetMainType (GUID guid)
 Returns the type of the main asset for the GUID.
 
static Type GetSubType ([NotNull] Path path, Int64 fileId)
 Gets the type of a sub asset by the main asset's path and the local file ID of the sub-asset.
 
static void Import ([NotNull] IEnumerable< Path > paths, ImportAssetOptions options=ImportAssetOptions.Default)
 Imports multiple paths that were created or modified 'externally'. Externally refers to any means other than AssetDatabase methods such as System.IO or batch scripts.
 
static void Import ([NotNull] IEnumerable< string > paths, ImportAssetOptions options=ImportAssetOptions.Default)
 Imports multiple paths that were created or modified 'externally'. Externally refers to any means other than AssetDatabase methods such as System.IO or batch scripts.
 
static void Import ([NotNull] Path path, ImportAssetOptions options=ImportAssetOptions.Default)
 Imports a file at a given path that was created or modified 'externally'. Externally refers to any means other than AssetDatabase methods such as System.IO or batch scripts.
 
static T ImportAndLoad< T > ([NotNull] Path path, ImportAssetOptions options=ImportAssetOptions.Default)
 Imports a file at a given path that was created or modified 'externally', then loads and returns the asset object. See CodeSmileEditor.Asset.File.Import for more info.
 
static T Load< T > ([NotNull] Path path)
 Loads an asset at path.
 
static AssetDatabaseLoadOperation LoadAsync ([NotNull] Path path, Int64 localFileId)
 Loads an object and its dependencies asynchronously.
 
static T LoadMain< T > ([NotNull] Path path)
 Loads the main (root) asset at the path.
 
static T LoadMain< T > (GUID guid)
 Loads the main (root) asset object for the GUID.
 
static T LoadOrCreate< T > ([NotNull] Path path, [NotNull] Func< T > getInstance)
 Loads an asset at path or creates the asset if needed.
 
static Boolean Move ([NotNull] Path sourcePath, [NotNull] Path destinationPath)
 Moves an asset file to destination path.
 
static void OpenExternal ([NotNull] Object asset, Int32 lineNumber=-1, Int32 columnNumber=-1)
 Opens the asset in the application associated with the file's extension.
 
static void OpenExternal ([NotNull] Path path, Int32 lineNumber=-1, Int32 columnNumber=-1)
 Opens the asset in the application associated with the file's extension.
 
static void OpenExternal (Int32 instanceId, Int32 lineNumber=-1, Int32 columnNumber=-1)
 Opens the asset in the application associated with the file's extension.
 
static Boolean Rename ([NotNull] Path path, String newFileName)
 Renames an asset's file or folder name.
 
static void Save ([NotNull] Object asset)
 Saves the object to disk if it is dirty.
 
static void Save (GUID guid)
 Saves any changes to the asset to disk, by GUID.
 
static Boolean Trash ([NotNull] IEnumerable< Path > paths)
 Tries to move multiple files/folders to the OS trash.
 
static Boolean Trash ([NotNull] IEnumerable< String > paths)
 Tries to move multiple files/folders to the OS trash.
 
static Boolean Trash ([NotNull] Object asset)
 Moves an asset file or folder to the OS trash.
 
static Boolean Trash ([NotNull] Path path)
 Moves an asset file or folder to the OS trash.
 

Properties

static IList< String > PathsNotDeleted [get]
 The paths that failed to be deleted or trashed. Is an empty list if no failure occured on the last call to DeleteMany or TrashMany.
 

Detailed Description

Groups file related operations.

Definition at line 32 of file Asset.File.cs.