- Home /
What's the syntax for creating a skybox with a script?
I'm trying to make a skybox dynamically, here's a fragment:
var skymat = new Material (Shader.Find ("RenderFX/Skybox"));
var wwwf : WWW = new WWW (params[0]);
yield wwwf;
skymat.SetTexture("_Front", wwwf.texture);
I get
Material doesn't have a texture property '_Front'
I've also tried 'Front', 'front', and '_front', and variations including (+z) as well
What gives?
Answer by DaveA · Feb 13, 2011 at 08:08 PM
Was looking at shader source as you (PeterG) were answering. All I had to do was find and download the sources and look into that shader. Simple! This UI is not doing us any favors! I don't like obfuscation. That said, the correct syntax is, for anyone following in my footsteps:
"_FrontTex"
Very helpful - Thanks! (and you probably also need: _BackTex, _LeftTex, _RightTex ... for Skybox)
Answer by Peter G · Feb 13, 2011 at 08:05 PM
I haven't looked at the skybox shader, but you need to see the shader's property name. That's the first part of a property, it is normally proceeded by an underscore.
Properties {
_YouNeedThisValue("Ignore This", 2D) = "" {}
}
If you don't know what it is, then I suggest that you download the Unity buit-in shaders off the Resources page, and look it up.