getting a link to the skybox of the camera

Hi,
I’ve changed the clear-flags of the camera to “skybox” and added a skybox-component and a skybox-material to it.

Now I need access (per script) to the material loaded from the skybox-component because I want to change the offset of the front image during runtime…

Is there any way to get this problem solved?

(GetComponent (Skybox) as Skybox).material

thanks but how can I change the offset of the front side of the skybox? I’ve tried something like this but it didn’t work:

(GetComponent (Skybox) as Skybox).material.SetTextureOffset("Front",
		(GetComponent (Skybox) as Skybox).material.GetTextureOffset("Front") + 
		Vector2(1,0));

There is also a SetTextureOffset function.

Isn’t that the function I’m trying to use in my code? My problem is: I don’t know what the String for the front-texture is…

Ahem, sorry - I’ve no idea why I didn’t see that…

Anyway, the name of the texture property for the front image is actually “Front (+Z)”. You can get the source file for the skybox and all the built-in shaders from here.

thank you very much…

Now I can access to the texture-offets. I used the following code after I found out that the texture I’m seeing the _DownTex is:

(GetComponent (Skybox) as Skybox).material.SetTextureOffset("_DownTex",
		(GetComponent (Skybox) as Skybox).material.GetTextureOffset("_DownTex") + 
		Vector2(0,1));

But I can’t see my background moving…
Ok the Texture I’m using is really big (over 2000x1700px) but also when I’m trying to manipulate the value manually my background get streched and don’t move :frowning:

The texture offset is supplied as UV values, not pixels. If you apply an offset of one, you will slide the texture back round to where it was to begin with. Try using 0.01 or even a smaller value to shift the texture.