问题
当一个可能在每一帧实例化的对象出现在 View 中时,显示变黑
如何重现
- 在项目上导入Cardboard SDK
- 使用以下代码将脚本分配给任何适当的对象。
public GameObject prefab;
void GenerateObject(){
Instantiate(prefab);
}
void Update(){
if ( once ){
GenerateObject();
}
}
- 在 Unity 检查器上将任何适当的预制件附加到上面的预制件。
- 使用“Build and Run”在 Android 设备上启动应用程序。
- 当可能在每一帧实例化的对象出现在 View 中时,显示变黑。设置按钮也将消失。当实例化对象不在视线范围内时, View 变为正常。设置按钮将出现。
环境
Unity版本:5.0.0.1f
Cardboard SDK版本:v0.4.9
设备:Nexus5, nVidia SHIELD Tablet 2
最佳答案
Unity 和 CardboardSDK 之间存在一个已知错误。尝试在 Unity 的build设置中将build设置为开发。如果这解决了问题,那么您就找到了罪魁祸首。
由于这个错误,当我想要一个可以上传到 Play 商店的构建时,禁用场景中的大部分照明有时会有所帮助。
我们都在耐心等待修复。 Google 和 Unity 正在共同努力,但据说这是一个棘手的问题。
查看 known issues in SDK release notes .
Known Issues
Unity 5 rendering issues: As of Unity build 5.0.0f4, the following steps should be taken to fix or ameliorate any rendering issues, such as an all-black screen, flashing textures, or non-stereo views: Enable the Development Build option in the Build dialog. This seems to fix various rendering glitches, like flashing textures.
The root cause of the rendering glitches is under analysis, with assistance from Unity.
Note: If you are using any Image Effects, make sure that StereoController's Direct Render property is set to false. Check if that fixes the issue first.
关于android - 使用 Google Cardboard SDK Unity,当一个可能在每一帧实例化的对象出现在 View 中时,显示变黑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29756243/