another public variable problem

iv’e looked through like, a million different things to try to get an answer to this problem, copied countless pieces of code exactly, and still i couldn’t find the answer. I’m not trying to crowd up the answers, but this is kinda my last resort. I have two scripts because im making a light switch, one is a more general script to do all of the switching, and the other switches on/off the lights.

using UnityEngine;
using System.Collections;

public class SwitchingSwitches : MonoBehaviour {

public bool State = false;

	

	void Update () 
	{
		if (Input.GetMouseButtonDown (1) == true)
		{
			OnMouseDown ();
		}	
	}
	
	void OnMouseDown ()
	{
   		if(State == true)
		{
			animation.Play ("SwitchToggle");
			State = false;
		}
		else
		{
			animation.Play ("SwitchOffToggle");
			State = true;
		}
		
	}
}

and heres the problematic lights on off script

using UnityEngine;
using System.Collections;

public class LightsOnOff : MonoBehaviour {

public GameObject Lights;
public GameObject Switch;
public bool OnOff;

	void Awake () 
	{
		
	
	}
	

	void Update () 
	{
		SwitchingSwitches Switch = Switch.GetComponent< SwitchingSwitches>();
		Switch.State = OnOff;
		
	}
}

could someone pls tell me how to fix it?

It appears that the OnOff variable will always override the state in every frame. Is that intentional? This would cause you mouse events to only beagle to do one state depending on what OnOff is set to.