Photon Quantum 3.0.0

Classes | Static Public Member Functions | Static Public Attributes | List of all members
Quantum.Editor.AssetDatabaseUtils Class Reference

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 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...
 

Detailed Description

Utility methods for working with Unity's AssetDatabase

Member Function Documentation

◆ SetAssetAndTheMainAssetDirty()

static void Quantum.Editor.AssetDatabaseUtils.SetAssetAndTheMainAssetDirty ( UnityEngine.Object  obj)
inlinestatic

Sets the asset dirty and, if is a sub-asset, also sets the main asset dirty.

Parameters
obj

◆ GetAssetPathOrThrow() [1/3]

static string Quantum.Editor.AssetDatabaseUtils.GetAssetPathOrThrow ( int  instanceID)
inlinestatic

Returns the asset path for the given instance ID or throws an exception if the asset is not found.

◆ GetAssetPathOrThrow() [2/3]

static string Quantum.Editor.AssetDatabaseUtils.GetAssetPathOrThrow ( UnityEngine.Object  obj)
inlinestatic

Returns the asset path for the given object or throws an exception if obj is not an asset.

◆ GetAssetPathOrThrow() [3/3]

static string Quantum.Editor.AssetDatabaseUtils.GetAssetPathOrThrow ( string  assetGuid)
inlinestatic

Returns the asset path for the given asset GUID or throws an exception if the asset is not found.

◆ GetAssetGuidOrThrow() [1/3]

static string Quantum.Editor.AssetDatabaseUtils.GetAssetGuidOrThrow ( string  assetPath)
inlinestatic

Returns the asset GUID for the given asset path or throws an exception if the asset is not found.

◆ GetAssetGuidOrThrow() [2/3]

static string Quantum.Editor.AssetDatabaseUtils.GetAssetGuidOrThrow ( int  instanceId)
inlinestatic

Returns the asset GUID for the given instance ID or throws an exception if the asset is not found.

◆ GetAssetGuidOrThrow() [3/3]

static string Quantum.Editor.AssetDatabaseUtils.GetAssetGuidOrThrow ( UnityEngine.Object  obj)
inlinestatic

Returns the asset GUID for the given object reference or throws an exception if the asset is not found.

◆ MoveAssetOrThrow()

static void Quantum.Editor.AssetDatabaseUtils.MoveAssetOrThrow ( string  source,
string  destination 
)
inlinestatic

Moves the asset at source to destination or throws an exception if the move fails.

◆ HasLabel() [1/3]

static bool Quantum.Editor.AssetDatabaseUtils.HasLabel ( string  assetPath,
string  label 
)
inlinestatic

Returns true if the asset at assetPath has the given label .

◆ HasLabel() [2/3]

static bool Quantum.Editor.AssetDatabaseUtils.HasLabel ( UnityEngine.Object  obj,
string  label 
)
inlinestatic

Returns true if the asset obj has the given label .

◆ HasLabel() [3/3]

static bool Quantum.Editor.AssetDatabaseUtils.HasLabel ( GUID  guid,
string  label 
)
inlinestatic

Returns true if the asset guid has the given label .

◆ HasAnyLabel()

static bool Quantum.Editor.AssetDatabaseUtils.HasAnyLabel ( string  assetPath,
params string[]  labels 
)
inlinestatic

Returns true if the asset at assetPath has any of the given labels .

◆ SetLabel() [1/2]

static bool Quantum.Editor.AssetDatabaseUtils.SetLabel ( string  assetPath,
string  label,
bool  present 
)
inlinestatic

Sets or unsets label label for the asset at assetPath , depending on the value of present .

Returns
true if there was a change to the labels.

◆ SetLabel() [2/2]

static bool Quantum.Editor.AssetDatabaseUtils.SetLabel ( UnityEngine.Object  obj,
string  label,
bool  present 
)
inlinestatic

Sets or unsets the label label for the asset obj , depending on the value of present .

Returns
true if there was a change to the labels.

◆ SetLabels()

static bool Quantum.Editor.AssetDatabaseUtils.SetLabels ( string  assetPath,
string[]  labels 
)
inlinestatic

Sets all the labels for the asset at assetPath .

Returns
true if the asset was found

◆ HasScriptingDefineSymbol() [1/2]

static bool Quantum.Editor.AssetDatabaseUtils.HasScriptingDefineSymbol ( BuildTargetGroup  group,
string  value 
)
inlinestatic

Checks if a scripting define value is defined for group .

◆ SetScriptableObjectType()

static ScriptableObject Quantum.Editor.AssetDatabaseUtils.SetScriptableObjectType ( ScriptableObject  obj,
Type  type 
)
inlinestatic

Changes the type of scriptable object.

Returns
The new instance with requested type

◆ HasScriptingDefineSymbol() [2/2]

static ? bool Quantum.Editor.AssetDatabaseUtils.HasScriptingDefineSymbol ( string  value)
inlinestatic

Checks if any and all BuildTargetGroup have the given scripting define symbol.

Returns
true if all groups have the symbol, false if none have it, null if some have it and some don't

◆ UpdateScriptingDefineSymbol() [1/2]

static void Quantum.Editor.AssetDatabaseUtils.UpdateScriptingDefineSymbol ( BuildTargetGroup  group,
string  define,
bool  enable 
)
inlinestatic

Adds or removes define scripting define symbol from group , depending on the value of enable

◆ UpdateScriptingDefineSymbol() [2/2]

static void Quantum.Editor.AssetDatabaseUtils.UpdateScriptingDefineSymbol ( string  define,
bool  enable 
)
inlinestatic

Adds or removes define from all BuildTargetGroups, depending on the value of enable

◆ IterateAssets< T >()

static AssetEnumerable Quantum.Editor.AssetDatabaseUtils.IterateAssets< T > ( string  root = null,
string  label = null 
)
inlinestatic

Iterates over all assets in the project that match the given search criteria, without actually loading them.

Parameters
rootThe optional root folder
labelThe optional label
Type Constraints
T :UnityEngine.Object 

◆ IterateAssets()

static AssetEnumerable Quantum.Editor.AssetDatabaseUtils.IterateAssets ( string  root = null,
string  label = null,
Type  type = null 
)
inlinestatic

Iterates over all assets in the project that match the given search criteria, without actually loading them.

Parameters
rootThe optional root folder
labelThe optional label
typeThe optional type

◆ RegisterCustomDependencyWithMppmWorkaround()

static void Quantum.Editor.AssetDatabaseUtils.RegisterCustomDependencyWithMppmWorkaround ( string  customDependency,
Hash128  hash 
)
inlinestatic

Sends out QuantumMppmRegisterCustomDependencyCommand command to virtual peers before calling AssetDatabase.RegisterCustomDependency.

Member Data Documentation

◆ string

static Quantum.Editor.AssetDatabaseUtils.string
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.