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

◆ GetMainType() [2/2]

static Type GetMainType ( GUID guid)
static

Returns the type of the main asset for the GUID.

In Unity 2023.2 it uses AssetDatabase.GetMainAssetTypeFromGUID. The method exists in 2022.2 but not in the early patch versions 0f1 through 6f1. In earlier versions the type is obtained from the path's GUID.

Parameters
guidGuid of an asset.
Returns
Type of the asset. Null if the guid is not known or not an asset.
See also

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

910 {
911#if UNITY_2023_2_OR_NEWER // It's also available in 2022.2 but not in the early patch versions (eg 7f1 onwards)
912 return AssetDatabase.GetMainAssetTypeFromGUID(guid);
913#else
914 return GetMainType(Path.Get(guid));
915#endif
916 }
static Type GetMainType([NotNull] Path path)

References Asset.Path.Get(), and Asset.File.GetMainType().

+ Here is the call graph for this function: