I am trying to change the texture of a Unity Shader called “Skybox/PanormicBeta” in code.
It has a Texture property called “Spherical (HDR)” and I cant seem to figure out to how to swap it out at runtime.
I have tried using “material.maintexture = newTexture;” but it doesnt seem to work.
Any help would be greatly appreciated!
I solved the issue with some help, heres the solution to those that find this in the future:
You need to look into the shader code to find the texture property id, then use Material.SetTexture to change it.
Properties are usually listed at the very top and usually prefixed with an underscore.
“_MainTex” for example.
Also, you can look at the Shader in the inspector and see the properties right there, in my case I needed “_Tex”