调用LoadScene/LoadLevel后场景中的对象变暗 [英] Objects in Scene dark after calling LoadScene/LoadLevel

查看:125
本文介绍了调用LoadScene/LoadLevel后场景中的对象变暗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完成了Unity的滚球教程,并且效果很好.我更改了一些材料以使其看起来更好.我还添加了一个C#脚本,当玩家从地面掉下时,该脚本应该重新启动关卡(我禁用了墙壁).我正在使用Unity 5.5.

I completed Unity's roll-a-ball tutorial and it works fine. I changed a couple of materials to make it look better. I also added a C# script that should restart the level when the player falls off of the ground (I disables the walls). I am using Unity 5.5.

最初看起来像这样:

但是当我越过边缘并且关卡重新启动时,它看起来像这样: 加载编辑器时,打开统一后,有时看起来像这样几秒钟.

But when I go off the edge and the level restarts, it looks like this: It sometimes looks like this for a few seconds after opening unity when the editor is loading.

这是脚本:

using UnityEngine;
using System.Collections;

public class DeathTrigger : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }

    void OnTriggerEnter (Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
            Application.LoadLevel(Application.loadedLevel);
    }
}

关于什么原因的任何想法?

Any ideas on what's causing this?

推荐答案

已加载颜色和材料.这是一个照明问题,因为照明仍然在后台进行计算.这很可能会在仅 编辑器中发生.这应该在构建中发生.

The colors and materials are loaded. This is a lighting problem because lighliting is still calculating in the background. This will likely occur in the Editor only. This should not happen in the build.

根据您的Unity版本,您可以通过以下方法解决此问题:转到 Windows -> Lighting -> 设置,然后转到场景标签.向下滚动并禁用自动生成复选框,然后单击生成闪电按钮.

Depending on your Unity version, you can fix this by going to Windows --> Lighting --> Settings then go to the Scene tab. Scroll down and disable Auto Generate checkbox then click the Generate Lightning button.

有关没有自动生成复选框的Unity的较旧版本,请参见此处.

For older version of Unity with no Auto Generate checkbox, see here.

这篇关于调用LoadScene/LoadLevel后场景中的对象变暗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆