access a variable frrom a different script in c# code example
Example: how to get a variable from another script c#
GameObject Button = GameObject.Find("Button");
button button = Button.GetComponent<button>();
// ^ Name of script ^ Also name of script
button.Pressed = true