static string GetAssetGUID(GameObjectTreeViewItem item) { var go = (GameObject)item.objectPPTR; if (!go || PrefabUtility.GetNearestPrefabInstanceRoot(go) != go) { return(null); } var assetPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(go); return(AssetDatabase.AssetPathToGUID(assetPath)); }
private Asset GetAsset(GameObjectTreeViewItem item) { if (!Provider.isActive) { return(null); } GameObject go = (GameObject)item.objectPPTR; if (!go || PrefabUtility.GetNearestPrefabInstanceRoot(go) != go) { return(null); } string assetPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(go); var guid = AssetDatabase.AssetPathToGUID(assetPath); Asset vcAsset = string.IsNullOrEmpty(guid) ? null : Provider.GetAssetByGUID(guid); return(vcAsset); }