private static AssetReference GetReference(string relativePath, CreateReference creator) { AssetReferenceDatabase db = GetDatabase(); if (db.m_dictionary.ContainsKey(relativePath)) { return(db.m_dictionary[relativePath]); } else { try { AssetReference r = creator(); db.m_assets.Add(r); db.m_dictionary.Add(relativePath, r); AssetReferenceDatabase.SetDBDirty(); return(r); } catch (AssetReferenceException) { // if give asset is invalid, return null return(null); } } }
private static AssetReference GetReference(string relativePath, CreateReference creator) { AssetReferenceDatabase db = GetDatabase(); if (db.m_dictionary.ContainsKey(relativePath)) { return(db.m_dictionary[relativePath]); } else { try { AssetReference r = creator(); db.m_assets.Add(r); db.m_dictionary.Add(relativePath, r); AssetReferenceDatabase.SetDBDirty(); return(r); } catch (AssetReferenceException e) { LogUtility.Logger.LogWarning(LogUtility.kTag, $"AssetReference could not be created: Asset:{e.importFrom} Message:{e.Message}"); // if give asset is invalid, return null return(null); } } }