public static GUID GUIDFromAssetPath (string path);

Parameters

pathFilesystem path for the asset. All paths are relative to the project folder.

Returns

GUID The GUID of the asset. An all-zero GUID denotes an invalid asset path.

Description

Get the GUID for the asset at path.

Все пути относятся к папке проекта, например: "Assets/MyTextures/hello.png".

using UnityEngine;
using UnityEditor;

public static class Example { [MenuItem("AssetDatabase/GUIDFromAssetPath")] static void Doit() { GUID t = AssetDatabase.GUIDFromAssetPath("Assets/texture.jpg"); Debug.Log(t.ToString()); } }