CodeSmile AssetDatabase 1.9
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 993 of file Asset.File.cs.

994 {
995 if (asset == null)
996 return 0L;
997
998 // explicit variable + assign because Unity 2021 has both long and int variants of the TryGetGUID* method
999 var localId = Int64.MaxValue;
1000 return AssetDatabase.TryGetGUIDAndLocalFileIdentifier(asset, out var _, out localId) ? localId : 0L;
1001 }