/// <summary>Build the resource library from the assets</summary> private void Refresh() { var resources = new ResourceLibrary(); foreach (var asset in this.Assets.Where(a => a != null)) { var uri = "asset:{0}".FormatInvariant(AssetDatabase.GetAssetPath(asset.GetInstanceID())); var resource = asset as IResource ?? new GenericAssetResource <UnityEngine.Object>(asset); resources.AddResource(uri, resource); } // Update the library XML if (this.LibraryXml != null) { File.WriteAllText( AssetDatabase.GetAssetPath(this.LibraryXml.GetInstanceID()), resources.ToString()); } }