multi scripts 1 action the same in each. C#

OK i’ll try to explain this the best i can. I have have a main menu that has : New Game, Load Game, Options, and Exit. The Main Menu, New Game, Load Game, and Option are cameras with their own scripts for their GUI’s. They all use these var to reference each other.

//Back Button Varabels
	public GameObject MMCamra;
	public GameObject OPCamra;
	public GameObject OPCamra2;
	public GameObject OPCamra3;

Ops, New, and Load; all have a back button that does this.

Debug.Log("Switching to Main Menu");
MMCamra.gameObject.SetActive(true);
OPCamra.gameObject.SetActive(false);
OPCamra2.gameObject.SetActive(false);
OPCamra3.gameObject.SetActive(false);

So instead of using these lines of code on each script. i’m trying use one script on empty gameobject to do the above code. I hope i’m making scene here.

You could just put that set of code into a function like:

public void GoBack(){
Debug.Log("Switching to Main Menu");
MMCamra.gameObject.SetActive(true);
OPCamra.gameObject.SetActive(false);
OPCamra2.gameObject.SetActive(false);
OPCamra3.gameObject.SetActive(false);
}

And call that function whenever any of those back buttons is hit. I hope I understood you question right but let me know if thats not what you meant