Wrong button is pressed
I have 4 buttons (1,2,3,4) but only two of them work. When I press 1, the 2 button lights up green and when I press 3, the 4 button lights up green. Also, I've tried making the 2 and the 4 inactive and the 1 and the 3 now works so why does it not work with them.
Please!!! I really need an answer because the game is nearly finished and I want to publish it as soon as possible.
Would you be able to explain in a bit more detail? Thanks
It's quite difficult to explain. When I try to click on the 2, the 3 lights up etc. Even when I clicked on the left hand side of the 1 (the black screen) the 1 lights up. I've checked and rechecked the code and there's definitely nothing wrong there.
Yes. In the script it says. public void removeOthers(){ foreach(GameObject i in greens){ i.SetActive(false); } } public void changeColour(){ greens [0].SetActive (true); PlayerPrefs.SetInt("multiply",1); } public void changeColour1(){ greens [1].SetActive (true); PlayerPrefs.SetInt("multiply",2); } public void changeColour2(){ greens [2].SetActive (true); PlayerPrefs.SetInt("multiply",3); } public void changeColour3(){ greens [3].SetActive (true); PlayerPrefs.SetInt("multiply",4); } When I click one of the buttons, it calls the RemoveOthers function then the changeColour one depending on which one I pressed. Sorry the code's difficult to see as a comment. I can put it as an answer if you like.
I finally solved it!!! Basically the text of the numbers were wildly too high (560) and for some reason made it all go wrong so I made the height smaller and it works perfectly.
Hi Danny, Im beginner in Unity. I have same problem and dont know how to fix it. Did you find the answer or any solutions for this? thanks you
Your answer
![](https://koobas.hobune.stream/wayback/20220612072627im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Blend Cubemap Skybox Shader to Panoramic Shader 0 Answers
OnTriggerEnter and UI button 2 Answers