Utility methods for working with Unity's AssetDatabase More...
Classes | |
struct | AssetEnumerable |
Enumerable of assets in the project that match the given search criteria. More... | |
struct | AssetEnumerator |
Enumerates assets in the project that match the given search criteria using HierarchyProperty API. Obtained with AssetDatabaseUtils.IterateAssets. More... | |
Static Public Member Functions | |
static string | GetAssetGuidOrThrow (int instanceId) |
Returns the asset GUID for the given instance ID or throws an exception if the asset is not found. More... | |
static string | GetAssetGuidOrThrow (string assetPath) |
Returns the asset GUID for the given asset path or throws an exception if the asset is not found. More... | |
static string | GetAssetGuidOrThrow (UnityEngine.Object obj) |
Returns the asset GUID for the given object reference or throws an exception if the asset is not found. More... | |
static string | GetAssetPathOrThrow (int instanceID) |
Returns the asset path for the given instance ID or throws an exception if the asset is not found. More... | |
static string | GetAssetPathOrThrow (string assetGuid) |
Returns the asset path for the given asset GUID or throws an exception if the asset is not found. More... | |
static string | GetAssetPathOrThrow (UnityEngine.Object obj) |
Returns the asset path for the given object or throws an exception if obj is not an asset. More... | |
static bool | HasAnyLabel (string assetPath, params string[] labels) |
Returns true if the asset at assetPath has any of the given labels . More... | |
static bool | HasAnyLabel (UnityEngine.Object asset, params string[] labels) |
Returns true if the asset has any of the given labels . More... | |
static bool | HasLabel (GUID guid, string label) |
Returns true if the asset guid has the given label . More... | |
static bool | HasLabel (string assetPath, string label) |
Returns true if the asset at assetPath has the given label . More... | |
static bool | HasLabel (UnityEngine.Object obj, string label) |
Returns true if the asset obj has the given label . More... | |
static bool | HasScriptingDefineSymbol (BuildTargetGroup group, string value) |
Checks if a scripting define value is defined for group . More... | |
static ? bool | HasScriptingDefineSymbol (string value) |
Checks if any and all BuildTargetGroup have the given scripting define symbol. More... | |
static AssetEnumerable | IterateAssets (string root=null, string label=null, Type type=null) |
Iterates over all assets in the project that match the given search criteria, without actually loading them. More... | |
static AssetEnumerable | IterateAssets< T > (string root=null, string label=null) |
Iterates over all assets in the project that match the given search criteria, without actually loading them. More... | |
static void | MoveAssetOrThrow (string source, string destination) |
Moves the asset at source to destination or throws an exception if the move fails. More... | |
static void | RegisterCustomDependencyWithMppmWorkaround (string customDependency, Hash128 hash) |
Sends out QuantumMppmRegisterCustomDependencyCommand command to virtual peers before calling AssetDatabase.RegisterCustomDependency. More... | |
static void | SetAssetAndTheMainAssetDirty (UnityEngine.Object obj) |
Sets the asset dirty and, if is a sub-asset, also sets the main asset dirty. More... | |
static bool | SetLabel (string assetPath, string label, bool present) |
Sets or unsets label label for the asset at assetPath , depending on the value of present . More... | |
static bool | SetLabel (UnityEngine.Object obj, string label, bool present) |
Sets or unsets the label label for the asset obj , depending on the value of present . More... | |
static bool | SetLabels (string assetPath, string[] labels) |
Sets all the labels for the asset at assetPath . More... | |
static ScriptableObject | SetScriptableObjectType (ScriptableObject obj, Type type) |
Changes the type of scriptable object. More... | |
static T | SetScriptableObjectType< T > (ScriptableObject obj) |
static void | UpdateScriptingDefineSymbol (BuildTargetGroup group, string define, bool enable) |
Adds or removes define scripting define symbol from group , depending on the value of enable More... | |
static void | UpdateScriptingDefineSymbol (string define, bool enable) |
Adds or removes define from all BuildTargetGroups, depending on the value of enable More... | |
Static Public Attributes | |
static | string |
Gets the GUID and local file identifier for the given object reference or throws an exception if the asset is not found. More... | |
Utility methods for working with Unity's AssetDatabase
|
inlinestatic |
Sets the asset dirty and, if is a sub-asset, also sets the main asset dirty.
obj |
|
inlinestatic |
Returns the asset path for the given instance ID or throws an exception if the asset is not found.
|
inlinestatic |
Returns the asset path for the given object or throws an exception if obj is not an asset.
|
inlinestatic |
Returns the asset path for the given asset GUID or throws an exception if the asset is not found.
|
inlinestatic |
Returns the asset GUID for the given asset path or throws an exception if the asset is not found.
|
inlinestatic |
Returns the asset GUID for the given instance ID or throws an exception if the asset is not found.
|
inlinestatic |
Returns the asset GUID for the given object reference or throws an exception if the asset is not found.
|
inlinestatic |
Moves the asset at source to destination or throws an exception if the move fails.
|
inlinestatic |
Returns true
if the asset at assetPath has the given label .
|
inlinestatic |
Returns true
if the asset obj has the given label .
|
inlinestatic |
Returns true
if the asset guid has the given label .
|
inlinestatic |
Returns true
if the asset at assetPath has any of the given labels .
|
inlinestatic |
Returns true
if the asset has any of the given labels .
|
inlinestatic |
Sets or unsets label label for the asset at assetPath , depending on the value of present .
true
if there was a change to the labels.
|
inlinestatic |
Sets or unsets the label label for the asset obj , depending on the value of present .
true
if there was a change to the labels.
|
inlinestatic |
Sets all the labels for the asset at assetPath .
true
if the asset was found
|
inlinestatic |
Checks if a scripting define value is defined for group .
|
inlinestatic |
Changes the type of scriptable object.
|
inlinestatic |
Checks if any and all BuildTargetGroup have the given scripting define symbol.
true
if all groups have the symbol, false
if none have it, null
if some have it and some don't
|
inlinestatic |
Adds or removes define scripting define symbol from group , depending on the value of enable
|
inlinestatic |
Adds or removes define from all BuildTargetGroups, depending on the value of enable
|
inlinestatic |
Iterates over all assets in the project that match the given search criteria, without actually loading them.
root | The optional root folder |
label | The optional label |
T | : | UnityEngine.Object |
|
inlinestatic |
Iterates over all assets in the project that match the given search criteria, without actually loading them.
root | The optional root folder |
label | The optional label |
type | The optional type |
|
inlinestatic |
Sends out QuantumMppmRegisterCustomDependencyCommand command to virtual peers before calling AssetDatabase.RegisterCustomDependency.
|
static |
Gets the GUID and local file identifier for the given object reference or throws an exception if the asset is not found.
Gets the GUID and local file identifier for the instance ID or throws an exception if the asset is not found.