# Clicking in a UI Button activate another

I'm new to unity and creating my first game to learn more about it. Now i got a problem wich i click on a button and sometimes another button active, for example: i press "Options" on pause menu and it active "Restart" or the "Main Menu". if someone can help me, I appreciate it. I set them up like this, if there's any error or need more info please let me know. And in the first image i tried split in 2 canvas, but didn't work. P.S.: It happens even with buttons with no actions or scripts on them.

public void OnPause()
{
Time.timeScale = 0;
isPaused = true;
unPauseButton.SetActive(true);
pauseButton.SetActive(false);

GameObject.Find("PowerUpSpawner").GetComponent<PowerUpManager>().enabled = false;

}
public void UnPause()
{
Time.timeScale = 1;
pauseButton.SetActive(true);
unPauseButton.SetActive(false);
GameObject.Find("PowerUpSpawner").GetComponent<PowerUpManager>().enabled = true;
isPaused = false;

}

• Hello, could you give us the part of your code where you define the button actions please ? – Shashimee Jul 28 '17 at 14:06
• yeap, i edited the post take a look, but i forget to add it happens even in buttons wich don't have a actions defined. Like the arrows in the canvas i only set up them. – Lucas Gomes Jul 28 '17 at 14:13
• Okay. These are the actions that the buttons do, but how/where did you tell your program exactly "This button Pause should do this PauseAction" etc. ? There can be done in the code by gettint the button component and adding it a OnClick function, or in the inspector directly. – Shashimee Jul 28 '17 at 14:18
• Sorry my bad, I add it in the inspector directly – Lucas Gomes Jul 28 '17 at 14:21
• No problem, could you provide some picture of it ? :) Also, I didn't see any EventSystem object in your Canvas, it is necessary to correctly handle inputs like buttons – Shashimee Jul 28 '17 at 14:25

If you made sure that all of you functions are correctly mapped to the buttons (PauseAction for the Pause button etc.) then it must be your EventSystem object. You only need one for one canvas and having multiple can create conflits. You Canvas tree could look like this (I'm at work so no Unity image sorry) :

Canvas

• PauseButton
• EventSystem

You can just add the EventSystem as it is, no special configuration is necessary for your purposes.

You can reference the object that you want to activate as a public field.

public GameObject Target;
private Button button;
private void Awake()
{