I mad a Canvas prefab in a scene called, say, Scene 1 that has a UI Camera parented to it. This Canvas has scripting that controls several different menus and HUD ammo + health.
I made this Canvas into a prefab, but when I bring an instance of it into another scene, say Scene 2, the on screen buttons don’t work and cant be interacted with. Everything else is working fine with the prefab Canvas in Scene 2, like the health and ammo display and update, but I just can’t click the actual UI on screen buttons. Also, the controllers “Start” button and “Escape” key still work to pause and unpause the game and are contained in the same script that the buttons send methods to.
Also I deleted the original Canvas that I used to make the prefab out of Scene 1, then tried dragging another instance back into Scene 1, and the buttons still work fine. I can’t figure out why the buttons aren’t working with the Canvas prefab in Scene 2. Any ideas would be appreciated.
It feels like something might be blocking the mouse cursor from the buttons, but I’m not changing anything in the prefab and I’m pretty sure my script doesn’t depend on the name of the first scene to make the buttons work.
Make sure that there is exactly one EventSystem in the scene.
I built my UI in one scene, which automatically created the EventSystem in that scene (and I didn’t note it at the time). I built all of my UI under a root GameObject “EmptyLevelUI” and created a prefab from that root object. Then I brought that EmptyLevelUI prefab into another scene and couldn’t figure out why nothing was happening when I clicked my buttons. Of course the issue was that there was no EventSystem in the second scene. I actually chose to move the EventSystem into my “EmptyLevelUI” Prefab, which of course I imagine would break if I ever tried to create multiple instances or if there was another previously existing EventSystem in the scene, but since (at least at the moment) I’m only ever planning on using the EventSystem for my UI, that solution worked well for me, and now I can just drop my EmptyLevelUI prefab in each scene and I’m done, I don’t have to remember to create a separate EventSystem each time.
I had a problem similar to this and the reason to it was that I was trying to make changes to the panel prefab in the new scene rather than making changes to the prefab itself by selecting it from the project files. When I pulled up the prefab itself all the changes I was attempting to make went through just fine.
Also try checking that the graphic raycaster component on the parent canvas is ticked on, mine for some reason switched off in my prefabs but was checked in my initial instance.