【发布时间】:2017-01-15 16:59:52
【问题描述】:
在我的 3D Google Cardboard VR 迷你游戏中,在切换到另一个场景之前,我想将当前场景的背景淡化为白色以获得良好的过渡效果。
我构建了一个函数,可以在 2 秒内将颜色值从黄色变为白色:
within Update ():
if (started) {
if (startTime >= startDelay) {
//start
} else {
//fade
thisBrightness = startTime / 2; // runs 2 seconds
if (thisBrightness > 1) {
thisBrightness = 1; // just in case
}
Camera.main.backgroundColor = Color.Lerp (mainCameraBackground, mainCameraFaded, thisBrightness);
startTime += Time.deltaTime;
}
}
我记录了浮点数“thisBrightness”,它应该从 0 变为 1。此外,我可以在 inspector 中看到 Camera > Background 中的颜色字段发生了变化,但在我的 Game Preview 中却没有 - 颜色保持不变。
有人对此有任何解释和解决方案吗??! 1000 谢谢!
菲利克斯
Unity 5.5.0f3 个人版 谷歌纸板 1.0
【问题讨论】:
-
至少,现在我找到了解释:在运行时,Google Cardboard SDK 添加了 2 个新相机(左 + 右)作为主相机的子相机。现在我必须想办法改变它们的背景颜色;)
标签: c# unity3d google-cardboard