public static GameObject GetPrefab(this BridgeUI.Model.NodeInfo nodeInfo) { if (!string.IsNullOrEmpty(nodeInfo.guid)) { var path = AssetDatabase.GUIDToAssetPath(nodeInfo.guid); if (!string.IsNullOrEmpty(path)) { var prefab = AssetDatabase.LoadAssetAtPath <GameObject>(path); return(prefab); } } return(null); }
public static void SetPrefab(this BridgeUI.Model.NodeInfo nodeInfo, GameObject prefab) { if (prefab != null) { var path = AssetDatabase.GetAssetPath(prefab); if (!string.IsNullOrEmpty(path)) { nodeInfo.guid = AssetDatabase.AssetPathToGUID(path); } } else { nodeInfo.guid = null; } }