Building cubemap from runtime-loaded image
So I'm building an app that requires downloading a jpeg at runtime to be then used as the texture for a cubemap. The image is in the correct aspect ratio for a cylindrical cubemap, but I can't quite figure out how to set the correct settings to allow the image to be used for a cubemap. If I just try to do the following:
Texture tex = Resources.Load (path, typeof(Texture)) as Texture;
Material mat = new Material(Shader.Find("Skybox/Cubemap"));
mat.SetTexture ("_Tex", texture);
my_skybox.material = mat;
I get errors about setting a 3d object's texture to a 2d texture. I've looked at TextureImporter because I know in the editor I can use the import settings to specify that the texture should be rendered as a cubemap texture, but get compiler errors not recognizing the name when I try to use it in the script.
Any help? Thanks!
Comment