使用Shader.Find时,Unity Shader返回NULL. [英] unity Shader returns a NULL when using Shader.Find

查看:1047
本文介绍了使用Shader.Find时,Unity Shader返回NULL.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如所述这里我不是唯一发现以下问题的人:

As stated here I am not the only one finding the following problem:

Shader.Find返回Null.

Shader.Find returns a Null.

在上面的链接中,他们通过在资源文件夹中创建内容(?)提供了解决方案,但我不确定我是否理解.首先,这是否对所有情况都必要? (这意味着Shader.Find本身无法正常工作吗?) 第二,我应该添加什么?一个不亮的着色器?一种材料? 这里很困惑

In the link above they gave a solution by creating something(?) in the Resource Folder, but I am not sure I understand. First, is this necessary for all cases? (meaning Shader.Find does not work by itself?) Second, what should I add? An unlit shader?? a material? Very confused here

推荐答案

我可以通过执行以下操作最终解决该问题:

I could solve the problem finally by doing the following:

首先,进入统一编辑器:编辑"->项目设置"->图形" 然后在检查器中显示始终包含的着色器"的位置,添加未照亮/纹理"

First, go to unity editor: Edit->Project Settings-> Graphics Then in the inspector where it says "Always Included Shaders" add "Unlit/Texture"

然后更改我的Shader.Find代码以读取Shader.Find("Unlit/Texture");

Then change my Shader.Find code to read Shader.Find("Unlit/Texture");

有了它,它不再返回null

With this it does not return null anymore

这篇关于使用Shader.Find时,Unity Shader返回NULL.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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