static TextureProvider GetProviderForPath(string path, TextureDataSource source) { TextureProvider provider; if (!providers.TryGetValue(path, out provider)) { switch (source) { case TextureDataSource.WWW: provider = new TextureProviderWWW(path); break; case TextureDataSource.Resources: provider = new TextureProviderResources(path); break; case TextureDataSource.StreamingAssets: provider = new TextureProviderStream(path); break; } providers.Add(path, provider); } return(provider); }
public static void LoadTextureAsync(string path, TextureDataSource source, TextureFormat format, bool mipmaps, System.Action <Texture2D> action) { TextureProvider provider = GetProviderForPath(path, source); provider.LoadAsync(path, format, mipmaps, action); }
public static Texture2D LoadTexture(string path, TextureDataSource source, TextureFormat format, bool mipmaps) { TextureProvider provider = GetProviderForPath(path, source); return(provider.Load(path, format, mipmaps)); }