I'm currently writing a script to control environmental lighting of the scene. I have a drop down list and three scripts for different environmental lighting, script1, script2 and script3. In my control script, I wrote:
public class ControlScript : MonoBehaviour {
public Dropdown dropdown;
public script1 s1;
public script2 s2;
public script3 s3;
public void change() {
int option = dropdown.value;
disableAll();
switch (option){
case 0:
s1.enabled = true;
break;
case 1:
s2.enabled = true;
break;
case 2:
s3.enabled = true;
break;
}
private void disableAll() {
s1.enabled = false;
s2.enabled = false;
s3.enabled = false;
}
}
Then I attached this script to camera, set the scripts accordingly and set the change() method listens to the onValueChanged() event.
The change() method reacts correctly with the dropdown list, however, the scripts s1/s2/s3 are not enabled properly and thus performs no function. I tried to attach the s1,s2,s3 to the camera additionally, but doesn't seem to work.
Is there a way to solve this problem?
-------------------------------Edit Update------------------------------- The scripts s1, s2, s3 are just sudo codes to illustrate what I intend to do in this project. script s1 is an environmental lighting script using spherical harmonics, script s2 uses monte carlo sampling and script s3 uses median cut algorithm. The three scripts works well on their own when they are attached to the camera, however when I tried to control them using another script, after they have been disabled, even when setting them to be enabled the scripts still not function properly.