- Home /
The question is answered, right answer was accepted, I was the one who asked and solved it on my own, but I can't seem to find where to answer my own questions ><
UI Button Link breaking after scene load
Hello everyone,
I'm currently facing a problem where my buttons are not working when I load the scene a second time, the first picture shows what happens after the scene is loaded for the second time while the second picture shows the button in my scene at Editor.
I've trawled through google, and the closest I could find similar to my question is this: http://answers.unity3d.com/questions/913093/ui-buttons-stop-working-after-i-load-another-scene.html
But I've tried the answers provided there and still the problem exists. Does anyone know of a solution to this? I'm using Unity 5.3.1f.
Thanks and kind regards, Jason
Update: Still no luck left, but what I'm trying to do now is to manually add in the onClick function of the button script! I added a test script to try and check this out, but for some reason, it's still giving me the missing object as in the the first picture aboce.
[SerializeField]
private Button $$anonymous$$yButton = null; // assign in the editor
scene$$anonymous$$anager scene;
// Use this for initialization
void Start () {
scene = GameObject.Find ("Game$$anonymous$$anager").GetComponent<scene$$anonymous$$anager>();
if ($$anonymous$$yButton.onClick == null) {
$$anonymous$$yButton.onClick.AddListener(() =>
{
scene.GoToScene("Settings");
//$$anonymous$$yOtherFunction();
});
}
}
UPDATE 2: SOLVED!
Okay, I've solved the issue, seems like it was just a silly mistake on my part!
I solved the issue by removing the link and then re-linking the onClick function to the Game$$anonymous$$anager prefab that is saved in my project. I think I previously had this issue due to the fact that I linked it to the Game$$anonymous$$anager object that was in the scene(which got destroyed on load), therefore it was '$$anonymous$$issing'.
$$anonymous$$ade the same mistake... Thank you for this!