/// <summary> /// Creates a new instance of ExtendedAssets /// </summary> /// <param name="path">The path to the asset folder</param> /// <param name="window">The window containing this asset manager</param> public ExtendedAssets( string path, ExtendedWindow window ) { if ( string.IsNullOrEmpty( path ) ) { var type = window.Editor.GetType(); var files = Directory.GetFiles( Application.dataPath, string.Format( "*{0}.cs", type.Name ), SearchOption.AllDirectories ); if ( files.Length == 1 ) { var f = files[0]; var fi = new FileInfo( f ); this.Path = System.IO.Path.Combine( fi.DirectoryName, "Assets/" ); } } else { this.Path = path.ToLower().StartsWith( "assets" ) ? path : string.Format( "Assets/{0}", path ); } textures = new Dictionary<string, Texture2D>(); }
/// <summary> /// Destroys all the textures loaded for the given window /// </summary> /// <param name="window"></param> public void Destroy( ExtendedWindow window ) { foreach ( var item in textures ) { window.Editor.DestroyAsset( item.Value ); } }