// Selects the prefab if it is known. // Adds the prefab then selects it if is not known. public void Select(GameObject prefab) { if (prefab == null) { currentGuid = null; currentInfo = null; currentPrefab = null; } else { string guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(prefab)); PrefabInfo pi = null; if (prefabHash.TryGetValue(guid, out pi)) { if (currentInfo != null) { //we are deselecting an info. currentInfo.Deselect(); } currentGuid = guid; currentInfo = pi; currentInfo.name = prefab.name; currentPrefab = prefab; setPrefabAsRecentlyUsed(currentInfo); } else { Add(prefab); Select(prefab); // We must go deeper...BWOOOM } } }