public static string GetGuid(this UnityEngine.Object obj) { if (obj == null) { return(null); } string path = obj.GetPath(); if (string.IsNullOrEmpty(path) == false) { return(AssetDatabase.AssetPathToGUID(path)); } return(null); }