unity Shader returns a NULL when using Shader.Find

夙愿已清 提交于 2019-12-02 10:57:28

问题


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

Shader.Find returns a Null.

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


回答1:


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"

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

With this it does not return null anymore



来源:https://stackoverflow.com/questions/46033156/unity-shader-returns-a-null-when-using-shader-find

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!