Appear Button on canvas after a game

Hi,

I’m making a penalty game, how does i can make a button apear after i win a game ?
My ideia is, after i win the game, the button appears and this button haves a loadscene script attached to it (i already have this script), and then i can go ahead to other level in other scene

Just create a button. Place it where you want it to appear. Turn off the button. Then when you win the game, turn it on so the player can click on it.

Ok Thanks but how can i put the button turning on after i win a game ?
Does i have to put something in a C# Script ?

how are you currently determining whether you have “won” or not?

void Finalize()
  {
  textResult.text = "You Win";
  if (_countGoalMe < _countGoalAI)
  {
  textResult.text = "You Lose";
  }
  else if (_countGoalMe == _countGoalAI)
  {
  textResult.text = "Duel";
  }

  panelResult.SetActive(true);
  textResult.enabled = true;
  }

by the looks of it you are already “turning on” the panel and text (in last two lines), you just need to do something similar with a “button”…

Maybe if i add this to script it works ?

public GameObject MyButton;

MyButton.gameObject.setActive(true);
1 Like

yes. If you tie your button to that variable it will work. But since it’s already a GameObject, you don’t have to declare gameObject again.
Just use

MyButton.setActive(true);

Brathnann Thank you very much, i’ve added this to script and it work !! :smile:

public GameObject MyButton;
MyButton.setActive(true);