Mapping Buttons onClick issue

I’ve got a GameManager singleton that persists through all my scenes. It’s got a LoadLevel() function in it which needs to be called when certain uGUI buttons are clicked on in various scenes.

I’m running into two issues:

a. Mapping the buttons OnClick() via the editor needs to have a valid GO with the GameManager script on it. I can do that, but then…
b. The GameManager class can be instantiated in a different scene. When the new Scene loads with another GameManager already instantiated, the original GameManager detects the new Scenes GameManager and Destroys() it so there is only one in the scene. This, of course, buggers up the OnClick() event of the button which was mapped to the GO which was just destroyed.

Any suggestions on how to get around this?

As the UnityAction events need something physical to connect to (can’t use statics) then you are going to need a separate public script to call the static methods, e.g.:

public void CallGameManagerStart()
{
     GameManager.Instance.Start();
}

Then attach this script to something (e.g. main camera) in the scene and set it as the target for any Unity events

Yep, that’s what I thought… and desperately wanted to avoid!

Thanks for the help.