Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行时-URP动态添加overlay camera黑屏 #748

Open
LinNaiHao opened this issue Apr 29, 2024 · 5 comments
Open

运行时-URP动态添加overlay camera黑屏 #748

LinNaiHao opened this issue Apr 29, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@LinNaiHao
Copy link

描述Bug

场景里有一个base主相机,动态实例化一个overlay相机例如UI相机,通过Unity Api,动态添加到主相机的camerastack列表里。
UniversalAdditionalCameraData data = this.cam.GetUniversalAdditionalCameraData();
data.cameraStack.Add(uiCamera);
在Editor中是正常的,在小游戏运行时就会黑屏,且没有报错。

运行环境

Windows11/Unity2022.3.14f/minigame.202404262000/Assets导入/WebGL
@LinNaiHao LinNaiHao added the bug Something isn't working label Apr 29, 2024
@liuxinyumocn
Copy link
Collaborator

尝试下导出webgl版本在浏览器中是否正常

@LinNaiHao
Copy link
Author

也不行,我试了下只要在BaseCamera下面挂一个overlay的camera并添加到camerastack里,就会黑屏。不用动态添加也会。

@liuxinyumocn
Copy link
Collaborator

如果webgl版本在浏览器中也无法使用,这需要联系Unity相关人员解决。微信小游戏本质是基于webgl版本浏览器环境中运行。

@LinNaiHao
Copy link
Author

我刚刚进行了一系列测试。

  1. 2022.3.14f,新建一个2D的URP空项目。
  2. 新建一个相机,设置为overlay,将其加入主相机的camerastack中。
  3. 场景里放一个cube。
    以下导出按顺序执行
  4. 导出webgl运行,正常显示天空盒以及cube。
  5. 导入微信小游戏插件。
  6. 导出webgl运行,正常显示天空盒以及cube。
  7. 导出微信小游戏,画面变黑。
  8. 导出webgl运行,画面变黑。

@LinNaiHao
Copy link
Author

2021.3.33版本的Unity是正常的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants