生成assetBundle(.unity3d文件)后,Unity3d丢失了方向性光影

编程入门 行业动态 更新时间:2024-10-26 02:26:37
本文介绍了生成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丢失了方向性光影

本文发布于:2023-07-25 12:07:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1209755.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方向性   光影   文件   丢失了   assetBundle

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!