Converting Texture to Cube Map? C#

Hello,
I am trying to load a texture from a folder outside of the project (which works) and apply it to a material that is attached to skybox, which takes cubemap (RenderFX/Skybox Cubed Material Type). Here is my code that doesn’t work

string url =  "file://" + Application.dataPath.ToString() + "/Textures_Here/" + SkyboxName.ToString();

TexturLoading = new WWW (url);
WaitForTexture();
SkyboxMat.SetTexture("_Cube", TexturLoading.texture);

If I would make the material type “Diffuse” and in SetTexture I would set “_MainTex”, it would work but it would set whole texture to each side. So I need cubemap.

Anyone know way around it? Can I somehow convert the loaded texture to a cubemap?

Thank you

  • Konrad

You must use SkyboxMat.SetTexture(“_Tex”, TextureLoading.texture);