生成assetBundle(.unity3d文件)后,Unity3d丢失了方向性光影 [英] Unity3d lost directional light shadows after generate assetBundle (.unity3d file)

查看:108
本文介绍了生成assetBundle(.unity3d文件)后,Unity3d丢失了方向性光影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个统一的开发商.我为负载资产捆绑包创建了一个项目.我正在生成assetbundle(.unity3d)文件,然后将其加载到unity项目.但是我对资产捆绑的所有阴影都消失了.我怎么了请好帮我.

I am a unity developer. I build a project for load assetbundle. I was generate assetbundle (.unity3d) file and then load it to unity project. but all my shadows on assetbundle were lost. What is my problem? please kindly help me.

推荐答案

我遇到了同样的问题并设法解决了这个问题,似乎通过Assetbundle实例化了它的着色器,我使用此代码重新设置了所有场景中的着色器,它对我有用.

I have the same problem and managed to solve it, it seems like instantiating through assetbundles did something to it's shader, I used this code to re-set all of the shaders in the scene and it worked for me.

Shader standardShader;

void Start() {
    standardShader = Shader.Find("Standard");
}

void changeShader() // because shadow for assetbundle is cucked.
{
    var renderers = FindObjectsOfType<Renderer>() as Renderer[];
    for (int i = 0; i < renderers.Length; i++)
        renderers[i].material.shader = standardShader;
}

,并在所有实例化完成后调用它.

and called it after all of the instantiating is done.

希望这会有所帮助.

这是我的帖子实例化游戏对象错误的阴影?

这篇关于生成assetBundle(.unity3d文件)后,Unity3d丢失了方向性光影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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