- Home /
Question by
Tanoshimi2000 · Feb 28, 2016 at 05:51 PM ·
texturematerialskybox
How to access the textures within a skybox from script
So I have a shader that uses reflective textures, and I have it set to my skybox texture. But when my ship jumps sectors, the skybox changes drastically. How can I get the textures from the skybox to apply to my shaded material so the glass cockpit reflects the new skybox, not the old one?
Comment
Answer by Avash · Feb 29, 2016 at 01:30 AM
Material skybox = RenderSettings.skybox;
Texture2d frontMaterial = skybox. GetTexture("_FrontTex") ;
//_FrontTex, _BackTex, _LeftTex, _RightTex, _UpTex and _DownTex
You can use SetTexture().