我在游戏结束时有截屏预览。 当我加载屏幕截图时,它会暂停游戏。 我该怎么做,所以当我加载截图时,不会有冻结? 这是我的代码:
private IEnumerator ShowScreeshotPreview()
{
screenshotTexture = new Texture2D(Screen.height, Screen.height, TextureFormat.RGB24, false);
for (int i = 0; i < 9; i++)
{
yield return null;
}
RenderTexture.active = Singletons.Get<SpecialEffectsHelper>().MainCharacterScript.GetComponent<GeneratorScript>().screenshotTexture;
screenshotTexture.ReadPixels(new Rect(0, 0, Screen.height, Screen.height), 0, 0);
screenshotTexture.Apply();
RenderTexture.active = null; //Added to avoid errors
screenshotPrview.mainTexture = screenshotTexture;
screenshotPreviewAnimator.SetBool("visible", true);
screenshotLoaded = true;
yield return null;
}