While developing an application recently I found a typical problem and seeking your help to resort into a solution. Previously I used to load unlit transparent textures dynamically with the following code:
fileData = File.ReadAllBytes(filePath);
Texture2D tex = new Texture2D(2, 2);
tex.LoadImage(fileData);
GetComponent<Renderer>().material.mainTexture = tex;
rend = gameObject.GetComponent<Renderer>();
Shader shader = Shader.Find("Unlit/Texture");
rend.material.shader = shader;
Recently I found that Shader.Find(“Unlit/Texture”) doesn’t work in case of Windows build, specifically when I’m running the exe with my Unity Editor closed. I’m trying to find a substitute to this without any luck so far. I know in the Unity official documentation they have mentioned about the unreliability of Shader.Find, but no substitute to that is mentioned anywhere.
Will eagerly wait for a reply.
Thanks in advance for your time.,While developing an application recently I found a typical problem and seeking your help to resort into a solution. Previously I used to load unlit textures dynamically with the following code:
fileData = File.ReadAllBytes(filePath);
Texture2D tex = new Texture2D(2, 2);
tex.LoadImage(fileData);
GetComponent<Renderer>().material.mainTexture = tex;
rend = gameObject.GetComponent<Renderer>();
Shader shader = Shader.Find("Unlit/Texture");
rend.material.shader = shader;
Recently I found that Shader.Find(“Unlit/Texture”) doesn’t work in case of Windows build, specifically when I’m running the exe with my Unity Editor closed. I’m trying to find a substitute to this without any luck so far. I know in the Unity official documentation they have mentioned about the unreliability of Shader.Find, but no substitute to that is mentioned anywhere.