我是一个统一的开发商.我为负载资产捆绑包创建了一个项目.我正在生成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丢失了方向性光影
发布评论