Buttons not working as expected
Hey everyone! In my game, while I was working with 'buttons', these sometimes work but other times don't. If I change the Order in layer of the canvas of one button to make it work, it causes the other buttons to not work. I'm currently using Unity 2019.4.32f1.
I have even tried using Sorting Layer, even that doesn't seem to work.
Here's my heirarchy:-
Here's some of my code.
public void Restart()
{
PauseButton.SetActive(true);
Time.timeScale = 1f;
GameOverCanvas.GetComponent<CanvasGroup>().alpha = 0;
GameOverCanvas.GetComponent<CanvasGroup>().interactable = true;
TimeCount = 3;
Player.PlayerCanMove = false;
Cat.GetComponent<Transform>().position = new Vector3(-5.4f, 0.49f, 0f);
Cat.GetComponent<Transform>().rotation = Quaternion.Euler(0, 0, 0);
StartCoroutine(TimeCoroutineGameOver());
Debug.Log("The value of Player Can Move is " + Player.PlayerCanMove);
}
It would be highly appreciated if I get some help!
Sorry I'm old fashion man using OnGUI()
Tho I might learn canvas someday
I think the problem is not in the code. I find it more of a order in layer problem as the buttons work when I change the order in Layer, but it is causing other buttons to not work.
Oh alright. But the the thing is I have multiple canvas, even reordering them doesn't work for certain buttons.
Your answer
Follow this Question
Related Questions
VR camera switching between first person and "scaled model" view 0 Answers
How to make UI Button serves as buttons for Input.getAxis()? 0 Answers
unity 2017 Problem with touch and ui button 0 Answers
How to get Access of image as sprit in scripts 0 Answers
,Hi guys, I need help setting an app button to get it to my facebook page. 0 Answers