Search Issue Tracker

Active

Votes

3

Found in

Issue ID

1308740

Regression

No

Error in console when using the progress bar API along with Texture compression

Texture

-

When we use the function EditorUtility.CompressTexture inside a code that displays a progress bar, the progress bar doesn't show up and there is this message in the console instead:

> Trying to access current progress scope, but the scope stack is empty

Repro steps:
- Import the attached CompressTextureTest.cs script in a unity project
- Click on the "Tests/Compress Texture Test" menu
- Observe an error in the console instead of a progress bar.

Reproducible with Unity 2020.2 and 2021.1

Repro code:

```
using UnityEngine;
using UnityEditor;
using UnityEngine.Experimental.Rendering;

public class CompressTextureTest
{
[MenuItem("Tests/Compress Texture Test")]
static void Compress()
{
var texture = new Texture2D(2048, 2048, GraphicsFormat.R8G8B8A8_SRGB, TextureCreationFlags.None);

EditorUtility.DisplayProgressBar("Compressing Texture!", "Test", 0.0f);
EditorUtility.CompressTexture(texture, TextureFormat.BC7, TextureCompressionQuality.Best);
EditorUtility.ClearProgressBar();

Object.DestroyImmediate(texture);
}
}
```

Comments (2)

  1. 026ce1a6d49de69f4a106f73d4885af8?d=mm

    FreakForFreedom

    Jan 30, 2021 19:30

    Temporary workaround: Replacing with Texture2D.Compress() worked so far.

  2. 026ce1a6d49de69f4a106f73d4885af8?d=mm

    FreakForFreedom

    Jan 30, 2021 19:09

    Can confirm for 2020.2.2f1, found no solution to this yet :(

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.