public bool SyncFromProject() { ResourceCollection resourceCollection = new ResourceCollection(); string[] assetBundleNames = GetUsedAssetBundleNames(); foreach (string assetBundleName in assetBundleNames) { string name = assetBundleName; string variant = null; int dotPosition = assetBundleName.LastIndexOf('.'); if (dotPosition > 0 && dotPosition < assetBundleName.Length - 1) { name = assetBundleName.Substring(0, dotPosition); variant = assetBundleName.Substring(dotPosition + 1); } if (!resourceCollection.AddResource(name, variant, null, LoadType.LoadFromFile, false)) { return(false); } string[] assetNames = GetAssetPathsFromAssetBundle(assetBundleName); foreach (string assetName in assetNames) { string guid = AssetDatabase.AssetPathToGUID(assetName); if (string.IsNullOrEmpty(guid)) { return(false); } if (!resourceCollection.AssignAsset(guid, name, variant)) { return(false); } } } return(resourceCollection.Save()); }
public bool AddResource(string name, string variant, LoadType loadType, bool packed) { return(m_ResourceCollection.AddResource(name, variant, loadType, packed)); }