private void AdjustScale(ref Texture2D texture) { if (texture.width > Metadata.Context.TextureResolution.AsInt || texture.height > Metadata.Context.TextureResolution.AsInt) { var result = new ComputeRescaleStupid(texture, Metadata.Context.TextureResolution.AsVector).Execute(); GameObject.DestroyImmediate(texture); texture = result.ConvertToTexture2DAndRelease(); } if (texture.width < Metadata.Context.TextureResolution.AsInt || texture.height < Metadata.Context.TextureResolution.AsInt) { ReloadResource(); } }
protected override Texture2D GenerateThumbnail() { if (texture != null) { return(new ComputeRescaleStupid(texture, ThumbnailSize).Execute().ConvertToTexture2DAndRelease()); } else { var texture = LoadTextureFromCache(); if (texture == null) { return(null); } var thumbnail = new ComputeRescaleStupid(texture, ThumbnailSize).Execute().ConvertToTexture2DAndRelease(); GameObject.DestroyImmediate(texture); return(thumbnail); } }