- Home /
UI Buttons Stop Working After I Load Another Scene And Then Come Back.
Hi,
so i have a game over scene and i have 2 buttons (which i created using the new UI menu, i did't create them using script), a restart button and an end game button.
When i create the buttons and i add the OnClick function they work fine, but if i load a different scene and then come back to the game over scene they stop working, they don't even change colors when i hover over them or i press them.
I am having the same problem, both on Unity 4 and 5.
I set my UI to DontDestroy on load in my initial scene, and then I load the next scene. The UI buttons are there, but they stop working. They no longer highlight when moused over, and they do nothing when clicked.
Enabling the buttons before/after loading has no effect either.
The UI needs an EventSystem object to react to events, make sure you have one in your new scene.
If you're doing LoadLevelAdditive or marking things to not me destroyed you might be missing the EventSystem.
You are right, i had deleted the Event System. Ty.
I have same problem but this solution doesn't work with me.. any help ? I'm stuck here for 6 hours
Answer by Fdudka · Mar 23, 2016 at 11:38 AM
I might know what is wrong. add at Start() { Time.timeScale = 1; }
your game might have been paused to zero, and I don't know why Unity keeps the timescales... sometimes...
I specifically logged in just to thank you man. Thank you for this I've tried everything but this? I wouldn't have ever even considered it. Thanks for sharing this info.
Answer by Seven_P · Nov 25, 2015 at 09:21 AM
I had same problem just solved it by setting "Force module Active" @Event System
Yup, worked for me. Thanks! :) Still wondering why it's happening though.
I have same problem but this solution doesn't work with me.. any help ? I'm stuck here for 6 hours
I had to do this, but also the event system game object was not in a persistent game object in the hiearchy, so it didn't have DontDestroyOnLoad. I just made it part of another GameObject that had DontDestoryOnLoad AND followed Ironcross's advice for "Force $$anonymous$$odule Active" and all was well again. :)
Answer by bdilloughery_mvla · Apr 29, 2019 at 01:59 PM
Tried all of these and didn't fix it. Finally found my problem:
I'm using the standard 1st person controller asset, and it locks the cursor. Need to unlock the cursor when going back to the main menu.
In the past I have had: 1. UI textbox/image is on top of button so it isn't clickable 2. DontDestroyOnLoad doing wonky things 3. Accidentally deleting the "Event System" GameObject in your scene (maybe mispelled it) that handles things like buttons being clicked.
Cheers
Sorry can you tell me how did you do that beacause I have the same problem, I have the same standard asset 1st person controller and I have no idea how to do that?
I haven't used that standard asset in awhile, but here is a quick answer I found Googling it. I think you can find the the cursor lock state in the Standard Asset script and just change its true/false value. https://answers.unity.com/questions/1179026/standard-assets-first-person-controller-hiding-cur.html
Just wanted to login and say thank you so much, such a simple thing and I didn't realize it, thank you.
I'm making FPS and when I go back to the title screen the button didn't respond. As you commented, it was because the cursor on the FPS Controller was locked.
It was good to be fixed. Thank you!!!
「I'm using the standard 1st person controller asset, and it locks the cursor. Need to unlock the cursor when going back to the main menu.」
I was deleting my Event System this whole time... Thanks for the fix!