Programmatically creating a RenderFX/Skybox

I need to be able to assing new textures to a skybox faces at runtime because the scenery can change to an arbitrary number possible backgrounds queried on the fly remotly. I need in fact to do the same job as the skybox editor once you set the shader to RenderFX/Skybox

It seems that internal properties of RenderFX/Skybox are not accessible :frowning:

I would want to do stuff like:

//given newly loaded images,
//byte imRight.imLeft,imUp…

Skybox sb=this.camera.GetComponent();
Material newMat=new Material(UnityEngine.Shader.Find(“RenderFX/Skybox”));
Texture2D textRight=new Texture2D(1024,1024)
textRight.LoadImage(imRight);
newMat.SetTexture(“left”,textRight);
//same for the other images

//and then apply the material to the Skybox
sb.material=newMat;

Is it possible to do that with Unity pro 3.4.2?

If not is it possible to get the sources of these shaders of the editor?

I’m kind of new to those game IDEs. I was more used to low level 3D engines like Ogre and i would like to retrieve the same flexibility…

Ok i did it! just took the sources of the built in shaders on the unity site to get the right property to assign the texture on.
Code snippet:

string frontFaceFile = path + “front.jpg”;
string backFaceFile = path + “back.jpg”;
string rightFaceFile = path + “left.jpg”;
string leftFaceFile = path + “right.jpg”;
string upFaceFile = path + “up.jpg”;
string downFaceFile = path + “down.jpg”;

	string[] faceFiles = { frontFaceFile, backFaceFile, rightFaceFile, leftFaceFile, upFaceFile, downFaceFile };
	string[] shaderFaceParams = { "_FrontTex", "_BackTex", "_RightTex", "_LeftTex", "_UpTex", "_DownTex" };
	
	
	Skybox sb = this.GetComponent<Skybox> ();
	UnityEngine.Shader skyshader = Shader.Find ("Custom/CustomSkyBox");
	Material mat = new Material (skyshader);
	sb.material = mat;
	
	
	int loadingPoolCount = 0;
	for (int i = 0; i < 6; i++) {
		WWW t_load = null;
		t_load = new WWW (faceFiles*);*
  •   	while (!t_load.isDone) {*
    
  •   		Texture2D text = new Texture2D (1024, 1024);*
    
  •   		t_load.LoadImageIntoTexture (text);*
    
  •   		text.wrapMode=TextureWrapMode.Clamp;*
    

_ sb.material.SetTexture (shaderFaceParams*,text);_
_
loadingPoolCount++;_
_
if (loadingPoolCount >= maxImageLoadedPoolNum) {_
_
loadingPoolCount = 0;_
_
break;_
_
}*_

* }*
* }*