//when the button gets pressed public void ButtonPressed() { _counter++; ButtonLightSwitch lamp = this.transform.GetComponentInChildren <ButtonLightSwitch>(); lamp.ChangeTexture(); }
//to switch the light color public void BoxLightSwitch() { ButtonLightSwitch lamp = this.transform.GetComponentInChildren <ButtonLightSwitch>(); if (lamp != null) { lamp.ChangeTexture(); } }