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

◆ GetFileId()

static Int64 GetFileId ( [NotNull] Object asset)
static

Returns the local FileID of the object.

Parameters
asset
Returns
The local fileID or 0 if obj is null or not an asset.
See also

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

1060 {
1061 if (asset == null)
1062 return 0L;
1063
1064 // explicit variable + assign because TryGetGUIDAndLocalFileIdentifier has both an Int64 and an
1065 // Int32 overload on 2022.3.62f3 and only the Int64 form on 6000.6.0f1 and 6000.7.0a6; the
1066 // declared type selects the Int64 one
1067 var localId = Int64.MaxValue;
1068 return AssetDatabase.TryGetGUIDAndLocalFileIdentifier(asset, out var _, out localId) ? localId : 0L;
1069 }