[Boo] Skybox not change

Hi guys, I have variable name is sayi. This is sayi variable type to int. Simple if control. But skybox material isn’t change. My code;

import UnityEngine
import System.Collections

class Gokyuzu (MonoBehaviour): 

	def Start ():
		a as int = 0
		gok as Skybox
		gok.enabled = true
		if a == 0:
			gok.material("Sunny1 Skybox")
		else:
			gok.material("DawnDusk Skybox")
	
	def Update ():
		pass

How do you change skybox material? Thank you advanced for interest, now.

Good work…

Hi Kurt1996

Boo is great language.

I guess you didn’t assign to gok, did you?

Hi shinriyo,
I want change Edit->Render Settings->Skybox Material

Have you added a skybox component to your camera?

But How do I script control?

The same way you have above I presume.

The component will just give you something to reference

Here’s a c# version I just wrote and tested. Dont know boo though, so you can either just have a c# script in your project or convertit.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;


public class SkyController : MonoBehaviour {

	int index = 0;
	Skybox _skybox;
	public List<Material> SkyBoxes;
	// Use this for initialization
	void Start () {
		_skybox = (Skybox)GetComponent(typeof(Skybox));
		
		InvokeRepeating("NewSky", 10,10);
	}
	
	void NewSky()
	{
		if(_skybox == null || SkyBoxes == null)
			return;
		
		if(SkyBoxes.Count == 0)
			return;
		
		index++;
		if(index == SkyBoxes.Count)
			index = 0;
		
		_skybox.material = SkyBoxes[index];
	}
}